Skip to content

Instantly share code, notes, and snippets.

View katzueno's full-sized avatar

Katz Ueno katzueno

View GitHub Profile
@katzueno
katzueno / .htaccess
Last active January 30, 2018 00:27 — forked from hissy/.htaccess
Whitelisting IP for concrete5 dashboard / IP アドレス制限
## -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Change RewriteBase path if this concrete5 is installed on subdirectory / concrete5 がサブディレクトリにインストールされていたら、RewriteBase の変更が必要です。
# IP address restriction starts here / IP アドレス制限、アクセス許可するのIPの設定
RewriteCond %{REMOTE_ADDR} !123\.4\.56\.789
RewriteCond %{REMOTE_ADDR} !123\.123\.123\.123
# Add more lines is you have more IP / もっとIPがある場合は、行を追加してください
@katzueno
katzueno / concrete.php
Created February 12, 2016 03:52 — forked from hissy/concrete.php
#concrete5 #5.7 How to work concrete5 behind a load balancer or a reverse proxy
<?php
/**
* Always trust incoming request.
*
* application/config/concrete.php
*
* For more detail, see: http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html
*/
@katzueno
katzueno / .bash_profile
Last active May 11, 2016 04:28 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@katzueno
katzueno / PermissionSitemap.php
Last active June 9, 2016 12:14 — forked from hissy/PermissionSitemap.php
#concrete5 #version7 Show Permission Inheritance on Sitemap dynatree
<?php
// Upload this file to application/src/Application/Service/Dashboard/PermissionSitemap.php
namespace Application\Src\Application\Service\Dashboard;
use Page;
class PermissionSitemap extends \Concrete\Core\Application\Service\Dashboard\Sitemap
{
public function getNode($cItem, $includeChildren = true, $onGetNode = null)
@katzueno
katzueno / default.conf
Created July 15, 2016 03:00 — forked from gatespace/default.conf
網元でWordPressの管理画面にアクセス制限(IP or Basic認証)をかける時に /etc/nginx/conf.d/default.conf に追記する内容
server {
# (略)
location ~* /wp-login\.php|/wp-admin/((?!admin-ajax\.php).)*$ {
index index.php index.html index.htm;
# 許可するIPアドレスを記述
allow 192.168.0.1;
deny all;
# Basic認証のメッセージ
@katzueno
katzueno / clear_empty_workflow_progress.php
Last active November 28, 2016 00:19 — forked from hissy/clear_empty_workflow_progress.php
A job to deletes empty "Compare Versions" alert to clear Workflow concrete5
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{
@katzueno
katzueno / app.php
Last active May 25, 2017 07:21 — forked from hissy/app.php
concrete5 header tester
// application/bootstrap/app.php
Route::register('/ccm/request', function() {
header("Pragma: no-cache");
header("Pragma: no-cache");
echo '<dl>';
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
?><dt>Application environment:</dt><dd><?php echo ($app->environment()) ? $app->environment() : 'default'; ?></dd><?php
$request = \Concrete\Core\Http\Request::getInstance();
?><dt>Client IP:</dt><dd><?php echo $request->getClientIp(); ?></dd><?php
?><dt>Host:</dt><dd><?php echo $request->getHost(); ?></dd><?php
@katzueno
katzueno / app.php
Created November 3, 2016 08:46 — forked from hissy/app.php
#concrete5 HTTPS on SAKURA Internet
<?php
// application/bootstrap/app.php
$request = Request::getInstance();
if ($request->headers->has('HTTP_X_SAKURA_FORWARDED_FOR')) {
$request->server->set('HTTPS', 'on');
}
@katzueno
katzueno / add_page_by_composer.php
Created November 24, 2016 14:55 — forked from YuzuruSano/add_page_by_composer.php
コンポーザーを通して新規ページを追加して、初期出力の記事ブロックに記事を挿入する。自動実行ジョブにどうぞ
<?php
//ページタイプの「出力」で'Main'エリアにコンポーザーで扱うcontentブロックを入れてる場合
$pageType = \PageType::getByHandle('ページタイプハンドル');
$template = $pageType->getPageTypeDefaultPageTemplateObject();
$d = $pageType->createDraft($template);
$d->setPageDraftTargetParentPageID(親ページID);
$pageType->savePageTypeComposerForm($d);
$pageType->publish($d);
//$dには追加したページオブジェクトが入ってくる