public function url(string $url = '') : Ajax { // Veri bir url içermiyorsa siteUrl yöntemi ile url'ye dönüştürülür. if (!isUrl($url)) { $url = siteUrl($url); } $this->sets['url'] = "\turl:\"{$url}\"," . EOL; return $this; }
/** * Digunakan untuk mendapatkan URL saat ini * * @param string $permalink URL tambahan bila perlu * @return string */ function currentUrl($permalink = '', $trim = false) { $req = !empty($_GET) ? '?' . http_build_query($_GET) : ''; $url = siteUrl(app('uri')->path() . $req); if ($permalink) { $permalink = '/' . $permalink; } if ($trim === true) { $url = rtrim($url, '/'); } return $url . $permalink; }
public function url($url = '') { if (!is_string($url)) { Error::set(lang('Error', 'stringParameter', '1.(url)')); return $this; } // Veri bir url içermiyorsa siteUrl yöntemi ile url'ye dönüştürülür. if (!isUrl($url)) { $url = siteUrl($url); } $this->sets['url'] = "\turl:\"{$url}\"," . eol(); return $this; }
public function do(string $email = NULL, string $returnLinkPath = NULL) : bool { $email = Properties::$parameters['email'] ?? $email; $returnLinkPath = Properties::$parameters['returnLink'] ?? $returnLinkPath; Properties::$parameters = []; // ------------------------------------------------------------------------------ // Settings // ------------------------------------------------------------------------------ $tableName = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['table']; $senderInfo = INDIVIDUALSTRUCTURES_USER_CONFIG['emailSenderInfo']; $getColumns = INDIVIDUALSTRUCTURES_USER_CONFIG['matching']['columns']; $usernameColumn = $getColumns['username']; $passwordColumn = $getColumns['password']; $emailColumn = $getColumns['email']; // ------------------------------------------------------------------------------ if (!empty($emailColumn)) { DB::where($emailColumn, $email); } else { DB::where($usernameColumn, $email); } $row = DB::get($tableName)->row(); if (isset($row->{$usernameColumn})) { if (!isUrl($returnLinkPath)) { $returnLinkPath = siteUrl($returnLinkPath); } $encodeType = INDIVIDUALSTRUCTURES_USER_CONFIG['encode']; $newPassword = Encode::create(10); $encodePassword = !empty($encodeType) ? Encode::type($newPassword, $encodeType) : $newPassword; $templateData = array('usernameColumn' => $row->{$usernameColumn}, 'newPassword' => $newPassword, 'returnLinkPath' => $returnLinkPath); $message = Import::template('UserEmail/ForgotPassword', $templateData, true); Email::sender($senderInfo['mail'], $senderInfo['name'])->receiver($email, $email)->subject(lang('IndividualStructures', 'user:newYourPassword'))->content($message); if (Email::send()) { if (!empty($emailColumn)) { DB::where($emailColumn, $email); } else { DB::where($usernameColumn, $email); } if (DB::update($tableName, [$passwordColumn => $encodePassword])) { return $this->success = lang('IndividualStructures', 'user:forgotPasswordSuccess'); } return !($this->error = lang('Database', 'updateError')); } else { return !($this->error = lang('IndividualStructures', 'user:emailError')); } } else { return !($this->error = lang('IndividualStructures', 'user:forgotPasswordError')); } }
public function _initialize() { $res = CMS_M('website')->where('website_id=' . get_site_id())->find(); if (empty($_SESSION['tplPath'])) { $_SESSION['tplPath'] = 'Templates/' . trim($res['weburl']); } if (empty($_SESSION['siteUrl'])) { $_SESSION['siteUrl'] = siteUrl(get_site_id()); } //站点地址 $this->assign('siteUrl', $_SESSION['siteUrl']); //面包屑导航 $this->assign('site_nav', site_nav()); $this->assign('defaultPath', './Admin/Tpl/Templates/default'); $this->header(); $this->footer(); }
public function settings(array $config = []) : InternalPagination { $configs = VIEWOBJECTS_PAGINATION_CONFIG; // --------------------------------------------------------------------------------------- // Sayfalama Ayarlarını İçeren Değişkenler // --------------------------------------------------------------------------------------- if (isset($config['totalRows'])) { $this->totalRows = $config['totalRows']; } if (isset($config['start'])) { $this->start = $config['start']; } if (isset($config['limit'])) { $this->limit = $config['limit']; } if (isset($config['countLinks'])) { $this->countLinks = $config['countLinks']; } if (isset($config['prevName'])) { $this->prevTag = $config['prevName']; } if (isset($config['nextName'])) { $this->nextTag = $config['nextName']; } if (isset($config['firstName'])) { $this->firstTag = $config['firstName']; } if (isset($config['lastName'])) { $this->lastTag = $config['lastName']; } if (isset($config['type'])) { $this->type = $config['type']; } $this->class = array_merge($configs['class'], isset($config['class']) ? $config['class'] : []); $this->style = array_merge($configs['style'], isset($config['style']) ? $config['style'] : []); if (isset($config['url']) && $this->type !== 'ajax') { $this->url = suffix(siteUrl($config['url'])); } elseif ($this->type === 'ajax') { $this->url = '#prow='; } else { $this->url = suffix(CURRENT_CFURL); } // --------------------------------------------------------------------------------------- return $this; }
function redirect(string $url, int $time = 0, array $data = [], bool $exit = true) { if (!isUrl($url)) { $url = siteUrl($url); } if (!empty($data)) { foreach ($data as $k => $v) { Session::insert('redirect:' . $k, $v); } } if ($time > 0) { sleep($time); } header("Location: {$url}", true); if ($exit === true) { exit; } }
public function form($id = "") { if (empty($id)) { $head['title'] = 'Yönetici Ekle'; $head['meta']['author'] = 'Bursa yazılım'; $headData["kullaniciAdi"] = User::data()->username; $bodyVeri["data"] = ['action' => siteUrl('yonetim/ekle')]; $bodyVeri["data"] = ['action' => siteUrl('yonetim/ekle'), 'yoneticiDetay' => ["username" => "", "pass" => "", "email" => "", "isim" => "", "soyisim" => "", "durum" => "", "ban_durum" => ""]]; } else { $head['title'] = 'Yönetici Düzenle'; $head['meta']['author'] = 'Bursa yazılım'; $headData["kullaniciAdi"] = User::data()->username; $yoneticiDetay = $this->yonetici->detay($id); $bodyVeri["data"] = ['action' => siteUrl('yonetim/duzenle/' . $id), 'yoneticiDetay' => $yoneticiDetay]; } $data['head'] = Import::view('head', $headData, true); $data['footer'] = Import::view('footer', '', true); $data['body'] = Import::view('yonetimForm', $bodyVeri, true); Import::masterPage($data, $head); }
/** * Setup Anchor tag * * @param mixed $url Path or Permalink * @param string $label Text label * @return string */ function anchor($url, $label = '', array $extras = []) { if (is_array($url) and $label == '') { $attrs = $url; $label = $attrs['label']; unset($attrs['label']); } else { $attrs = ['href' => $url]; } $attrs = array_merge($extras, $attrs); if ($attrs['href'] == '' || substr($attrs['href'], 0, 2) != '//') { $attrs['href'] = siteUrl($attrs['href']); } elseif (strpos('?', $attrs['href']) === 1) { $attrs['href'] = currentUrl($attrs['href'], true); } if (!isset($attrs['class']) or isset($attrs['class']) and strpos($attrs['class'], 'btn') === false) { $attrs['tabindex'] = '-1'; } return '<a ' . parseAttrs($attrs) . '>' . $label . '</a>'; }
/** * サイトの設置URLを取得する */ public function testSiteUrl() { if (isConsole()) { $this->assertEquals('http://localhost/', siteUrl()); } else { $topLevelUrl = topLevelUrl(false); Configure::write('App.baseUrl', '/test/'); $this->assertEquals($topLevelUrl . '/test/', siteUrl()); Configure::write('App.baseUrl', '/test/index.php'); $this->assertEquals($topLevelUrl . '/test/', siteUrl()); Configure::write('App.baseUrl', '/test/hoge/'); $this->assertEquals($topLevelUrl . '/test/hoge/', siteUrl()); } }
/** * インストールファイルを生成する * * @return boolean * @access protected */ function _createInstallFile() { $corefilename = CONFIGS . 'install.php'; $siteUrl = siteUrl(); $installCoreData = array("<?php", "Configure::write('Security.salt', '" . $this->Session->read('Installation.salt') . "');", "Configure::write('Baser.firstAccess', true);", "Configure::write('Baser.siteUrl', '{$siteUrl}');", "Configure::write('Baser.sslUrl', '');", "Configure::write('Baser.adminSslOn', false);", "Configure::write('Baser.mobile', true);", "Configure::write('Baser.smartphone', true);", "Configure::write('Cache.disable', false);", "Cache::config('default', array('engine' => 'File'));", "?>"); if (file_put_contents($corefilename, implode("\n", $installCoreData))) { return chmod($corefilename, 0666); } else { return false; } }
?> </td> </tr> <?php } ?> </tbody> </thead> </table> <button type="submit" id="valider_lot" name="valider_lot" style="margin-left:35%;float:left" class="btn btn-primary" onclick="return confirm('Valider les lots ?');">Valider les lots</button> </form> <form id="generer_etiquettes" style="margin-bottom: 0%" action="<?php echo siteUrl(9, array('act' => 'generer_etiquettes'), true); ?> " method="post"> <button type="submit" name="generer_etiquettes" style="margin-left:5%;float:left" class="btn btn-success">Générer les étiquettes</button> </form> <h3 style="margin-top:8%" class="page-header"> Envoyés </h3> <table id="tab_lots_envoyes" class="table table-striped table-bordered table-hover" > <thead> <tr> <th>Nom</th> <th>Adresse</th> <th>Code Postal</th>
<?php defined('ROOT') or die('Not allowed!'); ?> <div id="main-sidebar" class="fright"> <div class="widget"> <h4 class="widget-title">Pencarian</h4> <form action="<?php echo siteUrl('shop'); ?> " method="get" id="product-search"> <input type="search" name="search" id="search"> <input type="submit" id="s-btn" class="btn" value="Cari"> </form> </div> <div class="widget"> <h4 class="widget-title">Kategori</h4> <ul class="widget-content"> <?php if (count($kategori) > 0) { foreach ($kategori as $row) { ?> <li><?php echo anchor('shop/index/category/' . $row->alias, $row->nama); ?> </li> <?php } } else { ?> <li>Kategori kosong.</li>
function redirect($url = '', $time = 0, $data = array(), $exit = true) { if (!is_string($url) || empty($url)) { return false; } if (!is_numeric($time)) { $time = '0'; } if (!is_bool($exit)) { $exit = true; } if (!isUrl($url)) { $url = siteUrl($url); } if (!empty($data)) { if (!isset($_SESSION)) { session_start(); } foreach ($data as $k => $v) { $_SESSION[md5('redirect:' . $k)] = $v; } } if ($time === 0) { header("Location: {$url}", true); } else { sleep($time); header("Location: {$url}", true); } if ($exit === true) { exit; } }
protected function _activation($user, $pass, $activationReturnLink, $email) { $url = suffix($activationReturnLink); if (!isUrl($url)) { $url = siteUrl($url); } $senderInfo = INDIVIDUALSTRUCTURES_USER_CONFIG['emailSenderInfo']; $templateData = ['url' => $url, 'user' => $user, 'pass' => $pass]; $message = Import::template('UserEmail/Activation', $templateData, true); $user = $email ?? $user; Email::sender($senderInfo['mail'], $senderInfo['name'])->receiver($user, $user)->subject(lang('IndividualStructures', 'user:activationProcess'))->content($message); if (Email::send()) { return $this->success = lang('IndividualStructures', 'user:activationEmail'); } else { return !($this->error = lang('IndividualStructures', 'user:emailError')); } }
public function form($id = "") { /* * Haber Form hem ekleme hemde güncellemede kullanılması için $id parametresi koyulmuştur. * Her yapılacak ekleme ve düzenleme işlemi için ayrı ayrı View dosyası oluşturup * dosya kalabalığı oluşturmak yerine bu şekilde kullanmayı tercih ediyorum * Eğer id boş ise haber ekleme yapar $id değeri dolu ise düzenleme yapmak için * $id değerine sahip ilgili haberin verisini çeker. * */ if (empty($id)) { $head['title'] = 'Haber Ekle'; $head['meta']['author'] = 'Bursa yazılım'; $headData["kullaniciAdi"] = User::data()->username; /* * haberForm view sayfası hem ekleme hem düzenlemede kullanıldığı için * View'da ki formun action adresini de değişkenle gönderiyoruz. * Bu if koşulu içinde $id boş olduğu için formumuz haber ekleme formu olarak çalışacak * else koşulu içinde ise düzenleme yapılacağından action verileri haber/duzenle 'ye gönderecek * */ $bodyVeri["data"] = ['action' => siteUrl('haber/ekle')]; /* * 'haberDetay'=>["baslik"=>"","detay"=>"","etiketler"=>"","durum"=>"" * dizilimi, haber ekleme formunda hata vermemesi için değişkenlere boş veri gönderir. * * */ $bodyVeri["data"] = ['action' => siteUrl('haber/ekle'), 'haberDetay' => ["baslik" => "", "detay" => "", "etiketler" => "", "durum" => ""]]; } else { $head['title'] = 'Haber Ekle'; $head['meta']['author'] = 'Bursa yazılım'; $headData["kullaniciAdi"] = User::data()->username; $haberDetay = $this->haberler->detay($id); $bodyVeri["data"] = ['action' => siteUrl('haber/duzenle/' . $id), 'haberDetay' => $haberDetay]; } $data['head'] = Import::view('head', $headData, true); $data['footer'] = Import::view('footer', '', true); $data['body'] = Import::view('haberForm', $bodyVeri, true); Import::masterPage($data, $head); }
/** * beforeFilter * * @return void */ public function beforeFilter() { parent::beforeFilter(); $isRequestView = $this->request->is('requestview'); $isUpdate = $this->request->is('update'); $isAdmin = $this->request->is('admin'); $isInstall = $this->request->is('install'); $isMaintenance = $this->request->is('maintenance'); // 設定されたサイトURLとリクエストされたサイトURLが違う場合は設定されたサイトにリダイレクト if ($isAdmin) { if ($this->request->is('ssl')) { $siteUrl = Configure::read('BcEnv.sslUrl'); } else { $siteUrl = Configure::read('BcEnv.siteUrl'); } if ($siteUrl && siteUrl() != $siteUrl) { $this->redirect($siteUrl . preg_replace('/^\\//', '', Router::reverse($this->request, false))); } } // メンテナンス if (!empty($this->siteConfigs['maintenance']) && Configure::read('debug') < 1 && !$isMaintenance && !$isAdmin && !BcUtil::isAdminUser()) { if (!empty($this->request->params['return']) && !empty($this->request->params['requested'])) { return; } else { $redirectUrl = '/maintenance'; if ($this->request->params['Site']['alias']) { $redirectUrl = '/' . $this->request->params['Site']['alias'] . $redirectUrl; } $this->redirect($redirectUrl); } } // セキュリティ設定 $this->Security->blackHoleCallback = '_blackHoleCallback'; if (!BC_INSTALLED || $isUpdate) { $this->Security->validatePost = false; } if ($isAdmin) { $this->Security->validatePost = false; $corePlugins = Configure::read('BcApp.corePlugins'); if (BC_INSTALLED && (!$this->plugin || in_array($this->plugin, $corePlugins)) && Configure::read('debug') === 0) { $this->Security->csrfCheck = true; } else { $this->Security->csrfCheck = false; } // SSLリダイレクト設定 if (Configure::read('BcApp.adminSsl')) { $adminSslMethods = array_filter(get_class_methods(get_class($this)), array($this, '_adminSslMethods')); if ($adminSslMethods) { $this->Security->requireSecure = $adminSslMethods; } } } //$this->Security->validatePost = false; // 送信データの文字コードを内部エンコーディングに変換 $this->__convertEncodingHttpInput(); // $this->request->query['url'] の調整 // 環境によって?キーにamp;が付加されてしまうため if (isset($this->request->query) && is_array($this->request->query)) { foreach ($this->request->query as $key => $val) { if (strpos($key, 'amp;') === 0) { $this->request->query[substr($key, 4)] = $val; unset($this->request->query[$key]); } } } // コンソールから利用される場合、$isInstall だけでは判定できないので、BC_INSTALLED も判定に入れる if (!BC_INSTALLED || $isInstall || $isUpdate) { return; } // Ajax ヘッダー if ($this->request->is('ajax')) { // キャッシュ対策 header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } // テーマ内プラグインのテンプレートをテーマに梱包できるようにプラグインパスにテーマのパスを追加 // =============================================================================== // 実際には、プラグインの場合も下記パスがテンプレートの検索対象となっている為不要だが、 // ビューが存在しない場合に、プラグインテンプレートの正規のパスがエラーメッセージに // 表示されてしまうので明示的に指定している。 // (例) // [変更後] app/webroot/theme/demo/blog/news/index.php // [正 規] app/plugins/blog/views/theme/demo/blog/news/index.php // 但し、CakePHPの仕様としてはテーマ内にプラグインのテンプレートを梱包できる仕様となっていないので // 将来的には、blog / mail / feed をプラグインではなくコアへのパッケージングを検討する必要あり。 // ※ AppView::_pathsも関連している // =============================================================================== $pluginThemePath = WWW_ROOT . 'theme' . DS . $this->theme . DS; $pluginPaths = Configure::read('pluginPaths'); if ($pluginPaths && !in_array($pluginThemePath, $pluginPaths)) { Configure::write('pluginPaths', am(array($pluginThemePath), $pluginPaths)); } // 認証設定 if (isset($this->BcAuthConfigure)) { $authConfig = array(); if (!empty($this->request->params['prefix'])) { $currentAuthPrefix = $this->request->params['prefix']; } else { $currentAuthPrefix = 'front'; } $authPrefixSettings = Configure::read('BcAuthPrefix'); foreach ($authPrefixSettings as $key => $authPrefixSetting) { if (isset($authPrefixSetting['alias']) && $authPrefixSetting['alias'] == $currentAuthPrefix) { $authConfig = $authPrefixSetting; $authConfig['auth_prefix'] = $authPrefixSetting['alias']; break; } if ($key == $currentAuthPrefix) { $authConfig = $authPrefixSetting; $authConfig['auth_prefix'] = $key; break; } } if ($authConfig) { $this->BcAuthConfigure->setting($authConfig); } else { $this->BcAuth->setSessionKey('Auth.' . Configure::read('BcAuthPrefix.admin.sessionKey')); } // ================================================================= // ユーザーの存在チェック // ログイン中のユーザーを管理側で削除した場合、ログイン状態を削除する必要がある為 // ================================================================= $user = $this->BcAuth->user(); if ($user && $authConfig) { $userModel = $authConfig['userModel']; $User = ClassRegistry::init($userModel); if (strpos($userModel, '.') !== false) { list($plugin, $userModel) = explode('.', $userModel); } if ($userModel && !empty($this->{$userModel})) { $conditions = array($userModel . '.id' => $user['id'], $userModel . '.name' => $user['name']); if (isset($User->belongsTo['UserGroup'])) { $UserGroup = ClassRegistry::init('UserGroup'); $userGroups = $UserGroup->find('all', array('conditions' => array('UserGroup.auth_prefix LIKE' => '%' . $authConfig['auth_prefix'] . '%'), 'recursive' => -1)); $userGroupIds = Hash::extract($userGroups, '{n}.UserGroup.id'); $conditions[$userModel . '.user_group_id'] = $userGroupIds; } if (!$User->find('count', array('conditions' => $conditions, 'recursive' => -1))) { $this->Session->delete(BcAuthComponent::$sessionKey); } } } } if ($isRequestView) { // テーマ、レイアウトとビュー用サブディレクトリの設定 $this->setTheme(); if (isset($this->request->params['prefix'])) { $this->layoutPath = str_replace('_', '/', $this->request->params['prefix']); $this->subDir = str_replace('_', '/', $this->request->params['prefix']); } if (!$isAdmin && !empty($this->request->params['Site']['name'])) { $agentSetting = Configure::read('BcAgent.' . $this->request->params['Site']['device']); if ($agentSetting && !empty($agentSetting['helper'])) { $this->helpers[] = $agentSetting['helper']; } if (isset($this->request->params['Site'])) { $this->layoutPath = $this->request->params['Site']['name']; $this->subDir = $this->request->params['Site']['name']; } } // 権限チェック if (isset($User->belongsTo['UserGroup']) && isset($this->BcAuth) && isset($this->request->params['prefix']) && empty($this->request->params['Site']['name']) && isset($this->request->params['action']) && empty($this->request->params['requested'])) { if (!$this->BcAuth->allowedActions || !in_array($this->request->params['action'], $this->BcAuth->allowedActions)) { $user = $this->BcAuth->user(); $Permission = ClassRegistry::init('Permission'); if ($user) { if (!$Permission->check($this->request->url, $user['user_group_id'])) { $this->setMessage('指定されたページへのアクセスは許可されていません。', true); $this->redirect($this->BcAuth->loginRedirect); } } } } } }
/** * インストール設定ファイルを生成する * * @return boolean * @access public */ public function createInstallFile($securitySalt, $secrityCipherSeed, $siteUrl = "") { $installFileName = APP . 'Config' . DS . 'install.php'; if (!$siteUrl) { $siteUrl = siteUrl(); } $installCoreData = array("<?php", "Configure::write('Security.salt', '{$securitySalt}');", "Configure::write('Security.cipherSeed', '{$secrityCipherSeed}');", "Configure::write('Cache.disable', false);", "Configure::write('Cache.check', true);", "Configure::write('Session.save', 'session');", "Configure::write('BcEnv.siteUrl', '{$siteUrl}');", "Configure::write('BcEnv.sslUrl', '');", "Configure::write('BcApp.adminSsl', false);", "Configure::write('BcApp.mobile', false);", "Configure::write('BcApp.smartphone', false);", "Cache::config('default', array('engine' => 'File'));", "Configure::write('debug', 0);"); if (file_put_contents($installFileName, implode("\n", $installCoreData))) { return chmod($installFileName, 0666); } else { return false; } }
public function forgotPassword($email = "", $returnLinkPath = "") { if (!is_string($email)) { return Error::set(lang('Error', 'stringParameter', 'email')); } if (!is_string($returnLinkPath)) { $returnLinkPath = ''; } // ------------------------------------------------------------------------------ // CONFIG/USER.PHP AYARLARI // Config/User.php dosyasında belirtilmiş ayarlar alınıyor. // ------------------------------------------------------------------------------ $userConfig = $this->config; $usernameColumn = $userConfig['usernameColumn']; $passwordColumn = $userConfig['passwordColumn']; $emailColumn = $userConfig['emailColumn']; $tableName = $userConfig['tableName']; // ------------------------------------------------------------------------------ $db = uselib('DB'); if (!empty($emailColumn)) { $db->where($emailColumn . ' =', $email); } else { $db->where($usernameColumn . ' =', $email); } $row = $db->get($tableName)->row(); $result = ""; if (isset($row->{$usernameColumn})) { if (!isUrl($returnLinkPath)) { $returnLinkPath = siteUrl($returnLinkPath); } $newPassword = Encode::create(10); $encodePassword = Encode::super($newPassword); $templateData = array('usernameColumn' => $row->{$usernameColumn}, 'newPassword' => $newPassword, 'returnLinkPath' => $returnLinkPath); $message = Import::template('UserEmail/ForgotPassword', $templateData, true); $sendEmail = uselib('Email'); $sendEmail->receiver($email, $email); $sendEmail->subject(lang('User', 'newYourPassword')); $sendEmail->content($message); if ($sendEmail->send()) { if (!empty($emailColumn)) { $db->where($emailColumn . ' =', $email); } else { $db->where($usernameColumn . ' =', $email); } $db->update($tableName, array($passwordColumn => $encodePassword)); $this->error = true; $this->success = lang('User', 'forgotPasswordSuccess'); return false; } else { $this->success = false; $this->error = lang('User', 'emailError'); return Error::set($this->error); } } else { $this->success = false; $this->error = lang('User', 'forgotPasswordError'); return Error::set($this->error); } }
</div> </div> <div class="control-group"> <label class="label" for="gambar">Gambar</label> <div class="control-input"> <input type="file" name="gambar"> <?php if ($data and $data->gambar) { ?> <input type="hidden" name="gambar" required value="<?php echo $data->gambar; ?> "> <img src="<?php echo siteUrl('asset/uploads/' . $data->gambar); ?> " alt="Gambar" class="thumb"> <?php } ?> </div> </div> <div class="control-group"> <label class="label" for="aktif">Aktif</label> <div class="control-input"> <input type="checkbox" name="aktif" value="1" <?php echo ($data and $data->aktif == 1) ? 'checked' : ''; ?> >
function fullSiteUrl($path) { $protocol = isSecure() ? 'https://' : 'http://'; $host = $_SERVER['HTTP_HOST']; return $protocol . $host . siteUrl($path); }
public function url(string $url) : InternalCalendar { if (!isUrl($url)) { $url = siteUrl($url); } $this->url = $url; return $this; }
/** * [ADMIN] 検索インデックス登録 * * TODO 2013/8/8 ryuring * この機能は、URLより、baserCMSで管理されたコンテンツのタイトルとコンテンツ本体を取得し、検索インデックスに登録する為の機能だったが、 * CakePHP2より、Viewの扱いが変更となった(ClassRegistryで管理されなくなった)為、requestAction 時のタイトルを取得できなくなった。 * よって機能自体を一旦廃止する事とする。 * 実装の際は、自動取得ではなく、手動で、タイトルとコンテンツ本体等を取得する仕様に変更する。 * * @return void * @access public */ public function admin_add() { $this->pageTitle = '検索インデックス登録'; if ($this->request->data) { $url = $this->request->data['Content']['url']; $url = str_replace(FULL_BASE_URL . $this->request->base, '', $url); if (!$this->Content->find('count', array('conditions' => array('Content.url' => $url)))) { // ルーティングのデフォルト設定を再読み込み(requestActionでルーティング設定がダブって登録されてしまう為) Router::reload(); // URLのデータを取得 try { $content = $this->requestAction($url, array('return' => 1)); } catch (Exception $e) { $content = $e; } Router::reload(); // 元の設定を復元 Router::setRequestInfo($this->request); if (!is_a($content, 'Exception')) { $content = preg_replace('/<!-- BaserPageTagBegin -->.*?<!-- BaserPageTagEnd -->/is', '', $content); } elseif (preg_match('/\\.html/', $url)) { App::uses('HttpSocket', 'Network/Http'); $socket = new HttpSocket(); // ※ Router::url() では、スマートURLオフの場合、/app/webroot/ 内のURLが正常に取得できない $HttpSocketResponse = $socket->get(siteUrl() . preg_replace('/^\\//', '', $url)); $code = $HttpSocketResponse->code; if ($code != 200) { unset($content); } else { if (preg_match('/<body>(.*?)<\\/body>/is', $HttpSocketResponse->body, $matches)) { $content = $matches[1]; } else { $content = ''; } } } else { unset($content); } if (isset($content)) { $content = Sanitize::stripAll($content); $content = strip_tags($content); $data = array('Content' => array('title' => $this->request->data['Content']['title'], 'detail' => $content, 'url' => $url, 'type' => 'その他', 'status' => true, 'priority' => 0.5)); $this->Content->create($data); if ($this->Content->save()) { $this->setMessage('検索インデックスに ' . $url . ' を追加しました。'); $this->redirect(array('action' => 'index')); } else { $this->setMessage('保存中にエラーが発生しました。', true); } } else { $this->Content->invalidate('url', '入力したURLは存在しないか、検索インデックスに登録できるURLではありません。'); $this->setMessage('保存中にエラーが発生しました。', true); } } else { $this->Content->invalidate('url', '既に登録済のURLです。'); $this->setMessage('入力エラーです。内容を修正してください。', true); } } $this->help = 'contents_add'; }
/** * [ADMIN] 検索インデックス登録 * * @return void * @access public */ function admin_add() { $this->pageTitle = '検索インデックス コンテンツ登録'; if ($this->data) { $url = $this->data['Content']['url']; $url = str_replace(FULL_BASE_URL . $this->base, '', $url); if (!$this->Content->find('count', array('conditions' => array('Content.url' => $url)))) { // ルーティングのデフォルト設定を再読み込み(requestActionでルーティング設定がダブって登録されてしまう為) Router::reload(); // URLのデータを取得 $content = $this->requestAction($url, array('return' => 1)); $View =& ClassRegistry::getObject('View'); // requestActionでインスタンス化されたViewを削除 // (管理システムではなく公開ページのView情報になっている可能性がある為) ClassRegistry::removeObject('View'); // ルーティングのデフォルト設定を再読み込み(元の設定に復元する為) Router::reload(); // 元の設定を復元 Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot))); $title = ''; if (!is_a($content, 'ErrorHandler')) { $content = preg_replace('/<!-- BaserPageTagBegin -->.*?<!-- BaserPageTagEnd -->/is', '', $content); $title = $View->pageTitle; } elseif (preg_match('/\\.html/', $url)) { App::import('Core', 'HttpSocket'); $socket = new HttpSocket(); // ※ Router::url() では、スマートURLオフの場合、/app/webroot/ 内のURLが正常に取得できない $content = $socket->get(siteUrl() . $url); $code = $socket->response['status']['code']; if ($code != 200) { unset($content); } else { if (preg_match('/<title>([^<]+)<\\/title>/', $content, $matches)) { $title = $matches[1]; $content = preg_replace('/<title>[^<]+<\\/title>/', '', $content); } } } else { unset($content); } if (isset($content)) { $content = Sanitize::stripAll($content); $content = strip_tags($content); $data = array('Content' => array('title' => $title, 'detail' => $content, 'url' => $url, 'type' => 'その他', 'status' => true, 'priority' => 0.5)); $this->Content->create($data); if ($this->Content->save()) { $this->Session->setFlash('検索インデックスに ' . $url . ' を追加しました。'); $this->redirect('index'); } else { $this->Session->setFlash('保存中にエラーが発生しました。'); } } else { $this->Content->invalidate('url', '入力したURLは存在しないか、検索インデックスに登録できるURLではありません。'); $this->Session->setFlash('保存中にエラーが発生しました。'); } } else { $this->Content->invalidate('url', '既に登録済のURLです。'); $this->Session->setFlash('入力エラーです。内容を修正してください。'); } } }
<th>Aktif</th> <th>Tipe</th> <th>Pilihan</th> </tr> </thead> <tbody> <?php if (($total = $data->count()) > 0) { foreach ($data->fetch() as $row) { ?> <tr id="data-<?php echo $row->id_banner; ?> "> <td><span class="thumb" style="background-image: url(<?php echo siteUrl('asset/uploads/' . $row->gambar); ?> );"></span></td> <td><?php echo '<strong>' . $row->judul . '</strong><br>' . $row->keterangan; ?> </td> <td class="acenter"><?php echo formatTanggal($row->tgl_mulai) . ' - ' . formatTanggal($row->tgl_akhir); ?> </td> <td class="acenter"><?php echo $row->aktif == 1 ? 'Ya' : 'Tidak'; ?> </td> <td class="acenter"><?php
public function action(string $url = NULL) { $this->settings['attr']['action'] = isUrl($url) ? $url : siteUrl($url); return $this; }
if ($haber["durum"] == "1") { ?> <label class="label label-success">Aktif</label> <?php } else { ?> <label class="label label-warning">Pasif</label> <?php } ?> </td> <td> <a href="<?php echo siteUrl('haber/form/' . $haber["id"]); ?> " class="btn btn-xs btn-warning" >Düzenle</a> <a href="<?php echo siteUrl('haber/sil/' . $haber["id"]); ?> " class="btn btn-xs btn-danger" >Sil</a> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div>
echo $this->BcForm->input('SearchIndex.priority' . '_' . $data['SearchIndex']['id'], array('type' => 'select', 'options' => $priorities, 'empty' => '優先度', 'class' => 'priority', 'value' => $data['SearchIndex']['priority'])); $this->BcBaser->link($this->BcBaser->getImg('admin/icn_tool_delete.png', array('alt' => '削除', 'class' => 'btn')), array('action' => 'ajax_delete', $data['SearchIndex']['id']), array('title' => '削除', 'class' => 'btn-delete')); $this->BcBaser->img('admin/ajax-loader-s.gif', array('id' => 'PriorityAjaxLoader' . $data['SearchIndex']['id'], 'style' => "vertical-align:middle;display:none")); ?> </td> <td><?php echo $data['SearchIndex']['id']; ?> </td> <td style="width:15%"> <?php echo $data['SearchIndex']['type']; ?> <br /> <?php echo $this->BcBaser->link($this->BcText->noValue($data['SearchIndex']['title'], '設定なし'), siteUrl() . preg_replace('/^\\//', '', $data['SearchIndex']['url']), array('target' => '_blank')); ?> </td> <td><?php echo $this->Text->truncate($data['SearchIndex']['detail'], 50); ?> </td> <td style="width:10%;text-align:center"> <?php echo $this->BcText->booleanMark($data['SearchIndex']['status']); ?> <br /> </td> <td style="width:10%;white-space: nowrap"> <?php echo $this->BcTime->format('Y-m-d', $data['SearchIndex']['created']);
/** * インストール完了メールを送信する * * @param string $email * @param string $name * @param string $password * @return void * @access protected */ protected function _sendCompleteMail($email, $name, $password) { if (DS !== '\\') { $body = array('name' => $name, 'password' => $password, 'siteUrl' => siteUrl()); $this->sendMail($email, 'baserCMSインストール完了', $body, array('template' => 'installed', 'from' => $email)); } }
//-------------------------------------------------------------------------------------------------- // BASE_URL //-------------------------------------------------------------------------------------------------- // // @return example.com/ // //-------------------------------------------------------------------------------------------------- define('BASE_URL', baseUrl()); //-------------------------------------------------------------------------------------------------- // SITE_URL //-------------------------------------------------------------------------------------------------- // // @return example.com/zeroneed.php // //-------------------------------------------------------------------------------------------------- define('SITE_URL', siteUrl()); //-------------------------------------------------------------------------------------------------- // CURRENT_URL //-------------------------------------------------------------------------------------------------- // // @return example.com/aktive // //-------------------------------------------------------------------------------------------------- define('CURRENT_URL', currentUrl()); //-------------------------------------------------------------------------------------------------- // PREV_URL //-------------------------------------------------------------------------------------------------- // // @return example.com/prev // //--------------------------------------------------------------------------------------------------