Esempio n. 1
0
    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']);
    }
Esempio n. 2
0
/**
 * アップデートの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);
}
Esempio n. 3
0
 /**
  * サイトの設置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());
     }
 }
Esempio n. 4
0
      ◆◇ baserCMSのインストールが完了しました ◇◆
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

 おめでとうございます!
 次のURLへbaserCMSのインストールが完了しました。
 <?php 
echo $siteUrl;
?>
 


━━━━◇◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ◆ ログイン情報
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◆◇━━━━
管理ページ: <?php 
echo topLevelUrl(false) . Configure::read('App.baseUrl') . '/admin/users/login';
?>
 
アカウント: <?php 
echo $name;
?>
 
パスワード: <?php 
echo $password;
?>
 
※ パスワードはユーザー管理より変更する事ができます。


━━━━◇◆━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ◆ baserCMSでどんな事ができるの?
Esempio n. 5
0
 /**
  * Parses a string URL into an array. If a plugin key is found, it will be copied to the
  * controller parameter
  *
  * @param string $url The URL to parse
  * @return mixed false on failure, or an array of request parameters
  */
 public function parse($url)
 {
     if (is_array($url)) {
         return false;
     }
     if (BcUtil::isAdminSystem($url)) {
         return false;
     }
     $request = Router::getRequest(true);
     //管理システムにログインしているかつプレビューの場合は公開状態のステータスは無視する
     $publish = true;
     if (!empty($request->query['preview']) || !empty($request->query['force'])) {
         $publish = false;
     }
     $sameUrl = false;
     $site = BcSite::findCurrentSub(true);
     if ($site) {
         // 同一URL対応
         $sameUrl = true;
         $checkUrl = $site->makeUrl($request);
         @header('Vary: User-Agent');
     } else {
         $site = BcSite::findCurrent(true);
         if (!is_null($site->name)) {
             if ($site->useSubDomain) {
                 $checkUrl = '/' . $site->alias . ($url ? $url : '/');
             } else {
                 $checkUrl = $url ? $url : '/';
             }
         } else {
             if (!empty($request->query['force']) && BcUtil::isAdminUser()) {
                 // =================================================================================================
                 // 2016/11/10 ryuring
                 // 別ドメインの際に、固定ページのプレビューで、正しくサイト情報を取得できない。
                 // そのため、文字列でリクエストアクションを送信し、URLでホストを判定する。
                 // =================================================================================================
                 $tmpSite = BcSite::findByUrl($url);
                 if (!is_null($tmpSite)) {
                     $site = $tmpSite;
                 }
             }
             $checkUrl = $url ? $url : '/';
         }
     }
     $content = $this->getContent($checkUrl, $publish, false, $sameUrl, $site->useSubDomain);
     if (!$content) {
         $content = $this->getContent($checkUrl, $publish, true, $sameUrl, $site->useSubDomain);
     }
     if (!$content) {
         return false;
     }
     // データが存在してもプレビューで管理システムにログインしていない場合はログイン画面に遷移
     if ((!empty($request->query['preview']) || !empty($request->query['force'])) && !BcUtil::loginUser()) {
         $_SESSION['Auth']['redirect'] = $_SERVER['REQUEST_URI'];
         header('Location: ' . topLevelUrl(false) . baseUrl() . Configure::read('BcAuthPrefix.admin.alias') . '/users/login');
         exit;
     }
     $Content = ClassRegistry::init('Content');
     if ($content['Content']['alias_id'] && !$Content->isPublishById($content['Content']['alias_id'])) {
         return false;
     }
     $request->params['Content'] = $content['Content'];
     $request->params['Site'] = $content['Site'];
     $url = $site->getPureUrl($url);
     $params = $this->getParams($url, $content['Content']['url'], $content['Content']['plugin'], $content['Content']['type'], $content['Content']['entity_id'], $site->alias);
     if ($params) {
         return $params;
     }
     return false;
 }
Esempio n. 6
0
/**
 * サイトの設置URLを取得する
 *
 * index.phpは含まない
 *
 * @return	string
 */
function siteUrl()
{
    $baseUrl = preg_replace('/index\\.php\\/$/', '', baseUrl());
    return topLevelUrl(false) . $baseUrl;
}