Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyautkin committed Oct 8, 2021
0 parents commit d9aef89
Show file tree
Hide file tree
Showing 4,082 changed files with 480,888 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
51 changes: 51 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM php:7.4-fpm

RUN apt-get update -y
RUN apt-get install -y \
libbz2-dev \
libxml2-dev \
git \
libzip-dev \
libc-client-dev \
libkrb5-dev \
libpng-dev \
libjpeg-dev \
libwebp-dev \
libfreetype6-dev \
libkrb5-dev \
libicu-dev \
zlib1g-dev \
zip \
ffmpeg \
libmemcached11 \
libmemcachedutil2 \
build-essential \
libmemcached-dev \
gnupg2 \
libpq-dev \
libpq5 \
libz-dev \
webp

RUN docker-php-ext-configure gd \
--with-webp=/usr/include/ \
--with-freetype=/usr/include/ \
--with-jpeg=/usr/include/

RUN docker-php-ext-install \
gd \
bz2 \
mysqli \
opcache \
pdo_mysql \
soap \
zip \
exif \
fileinfo

RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl

RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

USER 1000
45 changes: 45 additions & 0 deletions .docker/vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {
listen 80;
server_name localhost;
root /var/doodle/www;

error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;

index index.php index.html index.htm;

charset utf-8;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Host $host;
try_files $uri $uri/ @handler;

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}

location @handler {
rewrite / /index.php;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location ~ \.php$ {
if (!-e $request_filename) {
rewrite / /index.php last;
}

fastcgi_split_path_info ^(.+\.php)(/.+)$;

include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass php:9000;
fastcgi_hide_header X-Powered-By;
fastcgi_read_timeout 180;
}
}
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Logs and databases #
######################
*.log
*.logs
*.sql
*.sqlite
server-logs

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# IDE #
#######
.classpath
.project
.settings
.idea
.metadata
*.iml
*.ipr

# Other #
#########
.sass-cache
.phplint-cache
/node_modules
/bower_components
package.lock
package-lock.json

# Project #
###########
/www/core/config/config.environment.inc.php

# Cache #
#########
/www/core/cache
/www/assets/components/modxminify/cache
/www/assets/components/minifyx/cache
/www/assets/image-cache
/www/assets/cache_image
/www/assets/min/cache
/www/assets/components/imagestyles/cache
/www/assets/components/phpthumbof/cache
/www/assets/components/discuss/attachments
/www/assets/components/formit/attachments

# Files handled with Composer #
###############################
/www/composer.lock
/www/vendor
/www/core/vendor

# Assets #
##########
/www/assets/css/**/*.min.css
/www/assets/js/**/*.min.js

# Packages #
###############################
/www/core/packages
41 changes: 41 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "3"
services:
nginx:
image: nginx:latest
stdin_open: true
tty: true
ports:
- 80:80
volumes:
- 'nfsmount:/var/doodle'
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:delegated
depends_on:
- php

php:
build: '.docker/'
volumes:
- 'nfsmount:/var/doodle'

mariadb:
image: mariadb
ports:
- 3306:3306
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci'
]
volumes:
- ../mysql-data/database:/var/lib/mysql
environment:
MYSQL_DATABASE: doodle
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: trOgyy&gd34Kf

volumes:
nfsmount:
driver: local
driver_opts:
type: nfs
o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
device: ":${PWD}"
9 changes: 9 additions & 0 deletions www/config.core.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/*
* This file is managed by the installation process. Any modifications to it may get overwritten.
* Add customizations to the $config_options array in `core/config/config.inc.php`.
*
*/
define('MODX_CORE_PATH', '/var/doodle/www/core/');
define('MODX_CONFIG_KEY', 'config');
?>
9 changes: 9 additions & 0 deletions www/connectors/config.core.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/*
* This file is managed by the installation process. Any modifications to it may get overwritten.
* Add customizations to the $config_options array in `core/config/config.inc.php`.
*
*/
define('MODX_CORE_PATH', '/var/doodle/www/core/');
define('MODX_CONFIG_KEY', 'config');
?>
79 changes: 79 additions & 0 deletions www/connectors/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
*
* For complete copyright and license information, see the COPYRIGHT and LICENSE
* files found in the top-level directory of this distribution.
*/

/**
* @package modx
* @subpackage connectors
*/
$included = defined('MODX_CONNECTOR_INCLUDED') || defined('MODX_CORE_PATH');

/* retrieve or define MODX_CORE_PATH */
if (!defined('MODX_CORE_PATH')) {
if (file_exists(dirname(__FILE__) . '/config.core.php')) {
include dirname(__FILE__) . '/config.core.php';
} else {
define('MODX_CORE_PATH', dirname(__DIR__) . '/core/');
}

/* anonymous access for security/login action */
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'security/login') {
define('MODX_REQP', false);
}
}

/* include modX class - return error on failure */
if (!include_once(MODX_CORE_PATH . 'model/modx/modx.class.php')) {
header("Content-Type: application/json; charset=UTF-8");
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
echo json_encode(array(
'success' => false,
'code' => 404,
));
die();
}

/* load modX instance */
$modx = new modX('', array(xPDO::OPT_CONN_INIT => array(xPDO::OPT_CONN_MUTABLE => true)));

/* initialize the proper context */
$ctx = isset($_REQUEST['ctx']) && !empty($_REQUEST['ctx']) && is_string($_REQUEST['ctx']) ? $_REQUEST['ctx'] : 'mgr';
$modx->initialize($ctx);

/* check for anonymous access or for a context access policy - return error on failure */
if (defined('MODX_REQP') && MODX_REQP === false) {
} else if (!is_object($modx->context) || !$modx->context->checkPolicy('load')) {
header("Content-Type: application/json; charset=UTF-8");
header($_SERVER['SERVER_PROTOCOL'] . ' 401 Not Authorized');
echo json_encode(array(
'success' => false,
'code' => 401,
));
@session_write_close();
die();
}

/* set manager language in manager context */
if ($ctx == 'mgr') {
$ml = $modx->getOption('manager_language',null,'en');
if ($ml != 'en') {
$modx->lexicon->load($ml.':core:default');
$modx->setOption('cultureKey',$ml);
}
}

/* handle the request */
$connectorRequestClass = $modx->getOption('modConnectorRequest.class', null, 'modConnectorRequest');
$modx->config['modRequest.class'] = $connectorRequestClass;
$modx->getRequest();
$modx->request->sanitizeRequest();

if (!$included) {
$modx->request->handleRequest();
}
81 changes: 81 additions & 0 deletions www/connectors/lang.js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
*
* For complete copyright and license information, see the COPYRIGHT and LICENSE
* files found in the top-level directory of this distribution.
*/

/**
* Loads the lexicon into a JS-compatible function _()
*
* @var modX $modx
* @package modx
* @subpackage lexicon
*/
define('MODX_CONNECTOR_INCLUDED', 1);

ob_start();
require_once dirname(__FILE__).'/index.php';
ob_clean();

if (!empty($_REQUEST['topic'])) {
$topics = explode(',',$_REQUEST['topic']);
foreach($topics as $topic) $modx->lexicon->load($topic);
}

$entries = $modx->lexicon->fetch();
echo '
MODx.lang = {';
$s = '';
foreach ($entries as $k => $v) {
$s .= "'$k': ".'"'.esc($v).'",';
}
$s = trim($s,',');
echo $s.'
};
var _ = function(s,v) {
if (v != null && typeof(v) == "object") {
var t = ""+MODx.lang[s];
for (var k in v) {
t = t.replace("[[+"+k+"]]",v[k]);
}
return t;
} else return MODx.lang[s];
}';

function esc($s) {
return strtr($s,array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
}

/* gather output from buffer */
$output = ob_get_contents();
ob_end_clean();


/* if turned on, will cache lexicon entries in JS based upon http headers */
if ($modx->getOption('cache_lang_js',null,false)) {
$hash = md5($output);
$headers = $modx->request->getHeaders();

/* if Browser sent ID, check if they match */
if (isset($headers['If-None-Match']) && @preg_match($hash, $headers['If-None-Match'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
} else {
header("ETag: \"{$hash}\"");
header('Accept-Ranges: bytes');
//header('Content-Length: '.strlen($output));
header('Content-Type: application/x-javascript');

echo $output;
}
} else {
/* just output JS with no server caching */
//header('Content-Length: '.strlen($output));
header('Content-Type: application/x-javascript');
echo $output;
}
@session_write_close();
exit();
Loading

0 comments on commit d9aef89

Please sign in to comment.