diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..819a01b
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,92 @@
+# Allow access if Flarum is installed in a subdirectory,
+# but another .htaccess in a higher directory denies access.
+
+
+ Require all granted
+
+
+ Order Allow,Deny
+ Allow from all
+
+
+# Fix for https://httpoxy.org vulnerability
+
+ RequestHeader unset Proxy
+
+
+ SecRule &REQUEST_HEADERS:Proxy "@gt 0" "id:1000005,log,deny,msg:'httpoxy denied'"
+
+
+
+
+ RewriteEngine on
+
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
+ RewriteRule ^vendor/(.*)?$ / [F,L]
+ RewriteRule ^storage/(.*)?$ / [F,L]
+ RewriteRule ^config.php$ / [F,L]
+ RewriteRule /\.git / [F,L]
+ RewriteRule ^composer\.(lock|json)$ / [F,L]
+
+ RewriteRule ^api(.*)$ api.php [QSA,L]
+ RewriteRule ^admin(.*)$ admin.php [QSA,L]
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule !^assets index.php [QSA,L]
+
+ # MultiViews can mess up our rewriting scheme
+ Options -MultiViews
+
+ # Autoindex will list all assets files which is not so good
+ Options -Indexes
+
+
+
+ # Compress all output labeled with one of the following MIME-types
+
+ AddOutputFilterByType DEFLATE application/atom+xml \
+ application/javascript \
+ application/json \
+ application/vnd.ms-fontobject \
+ application/x-font-ttf \
+ application/x-web-app-manifest+json \
+ application/xhtml+xml \
+ application/xml \
+ font/opentype \
+ image/svg+xml \
+ image/x-icon \
+ text/css \
+ text/html \
+ text/plain \
+ text/xml
+
+
+
+# Configure cache expiry for different file types
+
+ ExpiresActive on
+ ExpiresDefault "access plus 1 second"
+
+ ExpiresByType text/css "access plus 1 year"
+ ExpiresByType application/json "access plus 0 seconds"
+ ExpiresByType application/xml "access plus 0 seconds"
+ ExpiresByType text/xml "access plus 0 seconds"
+ ExpiresByType image/x-icon "access plus 1 week"
+ ExpiresByType text/html "access plus 0 seconds"
+ ExpiresByType application/javascript "access plus 1 year"
+ ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
+ ExpiresByType text/cache-manifest "access plus 0 seconds"
+ ExpiresByType image/gif "access plus 1 month"
+ ExpiresByType image/jpeg "access plus 1 month"
+ ExpiresByType image/png "access plus 1 month"
+ ExpiresByType application/atom+xml "access plus 1 hour"
+ ExpiresByType application/rss+xml "access plus 1 hour"
+ ExpiresByType application/font-woff2 "access plus 1 month"
+ ExpiresByType application/font-woff "access plus 1 month"
+ ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
+ ExpiresByType application/x-font-ttf "access plus 1 month"
+ ExpiresByType font/opentype "access plus 1 month"
+ ExpiresByType image/svg+xml "access plus 1 month"
+
diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..93c0e99
--- /dev/null
+++ b/Procfile
@@ -0,0 +1,2 @@
+forum: cd vendor/flarum/core/js/forum && gulp watch
+admin: cd vendor/flarum/core/js/admin && gulp watch
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 0000000..bc5bd24
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,322 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Config Github Settings
+github_username = "fideloper"
+github_repo = "Vaprobash"
+github_branch = "1.4.2"
+github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"
+
+# Server Configuration
+hostname = "flarum.dev"
+
+# Set a local private network IP address.
+# See http://en.wikipedia.org/wiki/Private_network for explanation
+# You can use the following IP ranges:
+# 10.0.0.1 - 10.255.255.254
+# 172.16.0.1 - 172.31.255.254
+# 192.168.0.1 - 192.168.255.254
+server_ip = "192.168.29.29"
+server_cpus = "1" # Cores
+server_memory = "512" # MB
+server_swap = "768" # Options: false | int (MB) - Guideline: Between one or two times the server_memory
+
+# UTC for Universal Coordinated Time
+# EST for Eastern Standard Time
+# US/Central for American Central
+# US/Eastern for American Eastern
+server_timezone = "UTC"
+
+# Database Configuration
+mysql_root_password = "root" # We'll assume user "root"
+mysql_version = "5.5" # Options: 5.5 | 5.6
+mysql_enable_remote = "false" # remote access enabled when true
+pgsql_root_password = "root" # We'll assume user "root"
+mongo_enable_remote = "false" # remote access enabled when true
+
+# Languages and Packages
+php_timezone = "UTC" # http://php.net/manual/en/timezones.php
+php_version = "7.1" # Options: 5.6 | 7.0 | 7.1
+ruby_version = "latest" # Choose what ruby version should be installed (will also be the default version)
+ruby_gems = [ # List any Ruby Gems that you want to install
+ #"jekyll",
+ #"sass",
+ #"compass",
+]
+
+# To install HHVM instead of PHP, set this to "true"
+hhvm = "false"
+
+# PHP Options
+composer_packages = [ # List any global Composer packages that you want to install
+ #"phpunit/phpunit:4.0.*",
+ #"codeception/codeception=*",
+ "phpspec/phpspec:2.0.*@dev",
+ "squizlabs/php_codesniffer:1.5.*",
+ "franzl/studio:dev-master"
+]
+
+# Default web server document root
+# Symfony's public directory is assumed "web"
+# Laravel's public directory is assumed "public"
+public_folder = "/vagrant"
+
+laravel_root_folder = "/vagrant/laravel" # Where to install Laravel. Will `composer install` if a composer.json file exists
+laravel_version = "latest-stable" # If you need a specific version of Laravel, set it here
+symfony_root_folder = "/vagrant/symfony" # Where to install Symfony.
+
+nodejs_version = "latest" # By default "latest" will equal the latest stable version
+nodejs_packages = [ # List any global NodeJS packages that you want to install
+ "bower",
+ "gulp"
+]
+
+sphinxsearch_version = "rel22" # rel20, rel21, rel22, beta, daily, stable
+
+
+Vagrant.configure("2") do |config|
+
+ # Set server to Ubuntu 14.04
+ config.vm.box = "ubuntu/trusty32"
+
+ config.vm.define "Vaprobash" do |vapro|
+ end
+
+ if Vagrant.has_plugin?("vagrant-hostmanager")
+ config.hostmanager.enabled = true
+ config.hostmanager.manage_host = true
+ config.hostmanager.ignore_private_ip = false
+ config.hostmanager.include_offline = false
+ end
+
+ # Create a hostname, don't forget to put it to the `hosts` file
+ # This will point to the server's default virtual host
+ # TO DO: Make this work with virtualhost along-side xip.io URL
+ config.vm.hostname = hostname
+
+ # Create a static IP
+ config.vm.network :private_network, ip: server_ip
+
+ # A private dhcp network is required for NFS to work (on Windows hosts, at least)
+ # Windows users should use the winnfsd plugin: https://github.com/GM-Alex/vagrant-winnfsd
+ config.vm.network :private_network, type: "dhcp"
+
+ # Use NFS for the shared folder
+ config.vm.synced_folder ".", "/vagrant",
+ id: "core",
+ :nfs => true,
+ :mount_options => ['nolock,vers=3,udp,noatime,actimeo=1']
+
+ # If using VirtualBox
+ config.vm.provider :virtualbox do |vb|
+
+ vb.name = "FlarumVm"
+
+ # Set server cpus
+ vb.customize ["modifyvm", :id, "--cpus", server_cpus]
+
+ # Set server memory
+ vb.customize ["modifyvm", :id, "--memory", server_memory]
+
+ # Set the timesync threshold to 10 seconds, instead of the default 20 minutes.
+ # If the clock gets more than 15 minutes out of sync (due to your laptop going
+ # to sleep for instance, then some 3rd party services will reject requests.
+ vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
+
+ # Prevent VMs running on Ubuntu to lose internet connection
+ vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
+ vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
+
+ end
+
+ # If using VMWare Fusion
+ config.vm.provider "vmware_fusion" do |vb, override|
+ override.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
+
+ # Set server memory
+ vb.vmx["memsize"] = server_memory
+
+ end
+
+ # If using Vagrant-Cachier
+ # http://fgrehm.viewdocs.io/vagrant-cachier
+ if Vagrant.has_plugin?("vagrant-cachier")
+ # Configure cached packages to be shared between instances of the same base box.
+ # Usage docs: http://fgrehm.viewdocs.io/vagrant-cachier/usage
+ config.cache.scope = :box
+
+ config.cache.synced_folder_opts = {
+ type: :nfs,
+ mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
+ }
+ end
+
+ # Adding vagrant-digitalocean provider - https://github.com/smdahlen/vagrant-digitalocean
+ # Needs to ensure that the vagrant plugin is installed
+ config.vm.provider :digital_ocean do |provider, override|
+ override.ssh.private_key_path = '~/.ssh/id_rsa'
+ override.vm.box = 'digital_ocean'
+ override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
+
+ provider.token = 'YOUR TOKEN'
+ provider.image = 'Ubuntu 14.04 x64'
+ provider.region = 'nyc2'
+ provider.size = '512mb'
+ end
+
+ ####
+ # Base Items
+ ##########
+
+ # Provision Base Packages
+ config.vm.provision "shell", path: "#{github_url}/scripts/base.sh", args: [github_url, server_swap, server_timezone]
+
+ # optimize base box
+ config.vm.provision "shell", path: "#{github_url}/scripts/base_box_optimizations.sh", privileged: true
+
+ # Provision PHP
+ config.vm.provision 'shell', inline: "sudo add-apt-repository -y ppa:ondrej/php && sudo apt-get update && sudo apt-get -y install php#{php_version}-fpm php#{php_version}-curl php#{php_version}-mbstring php#{php_version}-xml php#{php_version}-mysql php#{php_version}-gd", run: "once"
+
+ # Enable MSSQL for PHP
+ # config.vm.provision "shell", path: "#{github_url}/scripts/mssql.sh"
+
+ # Provision Vim
+ # config.vm.provision "shell", path: "#{github_url}/scripts/vim.sh", args: github_url
+
+ # Provision Docker
+ # config.vm.provision "shell", path: "#{github_url}/scripts/docker.sh"
+
+
+ ####
+ # Web Servers
+ ##########
+
+ # Provision Apache Base
+ # config.vm.provision "shell", path: "#{github_url}/scripts/apache.sh", args: [server_ip, public_folder, hostname, github_url]
+
+ # Provision Nginx Base
+ config.vm.provision "shell", path: "#{github_url}/scripts/nginx.sh", args: [server_ip, public_folder, hostname, github_url]
+
+
+ ####
+ # Databases
+ ##########
+
+ # Provision MySQL
+ config.vm.provision "shell", path: "#{github_url}/scripts/mysql.sh", args: [mysql_root_password, mysql_version, mysql_enable_remote]
+
+ # Provision PostgreSQL
+ # config.vm.provision "shell", path: "#{github_url}/scripts/pgsql.sh", args: pgsql_root_password
+
+ # Provision SQLite
+ # config.vm.provision "shell", path: "#{github_url}/scripts/sqlite.sh"
+
+ # Provision RethinkDB
+ # config.vm.provision "shell", path: "#{github_url}/scripts/rethinkdb.sh", args: pgsql_root_password
+
+ # Provision Couchbase
+ # config.vm.provision "shell", path: "#{github_url}/scripts/couchbase.sh"
+
+ # Provision CouchDB
+ # config.vm.provision "shell", path: "#{github_url}/scripts/couchdb.sh"
+
+ # Provision MongoDB
+ # config.vm.provision "shell", path: "#{github_url}/scripts/mongodb.sh", args: mongo_enable_remote
+
+ # Provision MariaDB
+ # config.vm.provision "shell", path: "#{github_url}/scripts/mariadb.sh", args: [mysql_root_password, mysql_enable_remote]
+
+ ####
+ # Search Servers
+ ##########
+
+ # Install Elasticsearch
+ # config.vm.provision "shell", path: "#{github_url}/scripts/elasticsearch.sh"
+
+ # Install SphinxSearch
+ # config.vm.provision "shell", path: "#{github_url}/scripts/sphinxsearch.sh", args: [sphinxsearch_version]
+
+ ####
+ # Search Server Administration (web-based)
+ ##########
+
+ # Install ElasticHQ
+ # Admin for: Elasticsearch
+ # Works on: Apache2, Nginx
+ # config.vm.provision "shell", path: "#{github_url}/scripts/elastichq.sh"
+
+
+ ####
+ # In-Memory Stores
+ ##########
+
+ # Install Memcached
+ # config.vm.provision "shell", path: "#{github_url}/scripts/memcached.sh"
+
+ # Provision Redis (without journaling and persistence)
+ # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh"
+
+ # Provision Redis (with journaling and persistence)
+ # config.vm.provision "shell", path: "#{github_url}/scripts/redis.sh", args: "persistent"
+ # NOTE: It is safe to run this to add persistence even if originally provisioned without persistence
+
+
+ ####
+ # Utility (queue)
+ ##########
+
+ # Install Beanstalkd
+ # config.vm.provision "shell", path: "#{github_url}/scripts/beanstalkd.sh"
+
+ # Install Heroku Toolbelt
+ # config.vm.provision "shell", path: "https://toolbelt.heroku.com/install-ubuntu.sh"
+
+ # Install Supervisord
+ # config.vm.provision "shell", path: "#{github_url}/scripts/supervisord.sh"
+
+ # Install ØMQ
+ # config.vm.provision "shell", path: "#{github_url}/scripts/zeromq.sh"
+
+ ####
+ # Additional Languages
+ ##########
+
+ # Install Nodejs
+ config.vm.provision "shell", path: "#{github_url}/scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version, github_url)
+
+ # Install Ruby Version Manager (RVM)
+ # config.vm.provision "shell", path: "#{github_url}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version)
+
+ ####
+ # Frameworks and Tooling
+ ##########
+
+ # Provision Composer
+ config.vm.provision "shell", path: "#{github_url}/scripts/composer.sh", privileged: false, args: ["", composer_packages.join(" ")]
+
+ # Provision Laravel
+ # config.vm.provision "shell", path: "#{github_url}/scripts/laravel.sh", privileged: false, args: [server_ip, laravel_root_folder, public_folder, laravel_version]
+
+ # Provision Symfony
+ # config.vm.provision "shell", path: "#{github_url}/scripts/symfony.sh", privileged: false, args: [server_ip, symfony_root_folder, public_folder]
+
+ # Install Screen
+ # config.vm.provision "shell", path: "#{github_url}/scripts/screen.sh"
+
+ # Install Mailcatcher
+ # config.vm.provision "shell", path: "#{github_url}/scripts/mailcatcher.sh"
+
+ # Install git-ftp
+ # config.vm.provision "shell", path: "#{github_url}/scripts/git-ftp.sh", privileged: false
+
+ # Install Ansible
+ # config.vm.provision "shell", path: "#{github_url}/scripts/ansible.sh"
+
+ ####
+ # Local Scripts
+ # Any local scripts you may want to run post-provisioning.
+ # Add these to the same directory as the Vagrantfile.
+ ##########
+ config.vm.provision "shell", inline: "/bin/bash /vagrant/scripts/environment.sh --php-version #{php_version}", run: "once"
+
+end
diff --git a/admin.php b/admin.php
new file mode 100644
index 0000000..d9d5e64
--- /dev/null
+++ b/admin.php
@@ -0,0 +1,16 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require 'vendor/autoload.php';
+
+$server = new Flarum\Admin\Server(__DIR__);
+
+$server->listen();
diff --git a/api.php b/api.php
new file mode 100644
index 0000000..4b70ec0
--- /dev/null
+++ b/api.php
@@ -0,0 +1,16 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require 'vendor/autoload.php';
+
+$server = new Flarum\Api\Server(__DIR__);
+
+$server->listen();
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..626fda5
--- /dev/null
+++ b/index.php
@@ -0,0 +1,16 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require 'vendor/autoload.php';
+
+$server = new Flarum\Forum\Server(__DIR__);
+
+$server->listen();
diff --git a/scripts/aliases b/scripts/aliases
new file mode 100644
index 0000000..7c9fa30
--- /dev/null
+++ b/scripts/aliases
@@ -0,0 +1,69 @@
+#process & file related aliases
+alias 755='sudo chmod -R 755 *'
+alias 644='sudo chmod -R 644 *'
+
+#copy stuff to clipboard
+alias cl='fc -e - | pbcopy'
+alias cpwd='pwd | tr -d "\n" | pbcopy'
+alias pbcopy='xclip -selection clipboard'
+alias pbpaste='xclip -selection clipboard -o'
+
+#version control
+alias ga='git add -A'
+alias gc='git commit -m'
+alias gp='git push origin $(current_branch)'
+alias gpm='git push origin master'
+alias gpd='git push origin develop'
+alias gl='git log'
+alias glp='git log --pretty=format:"%an %s"'
+alias gs='git status'
+alias ungit="find . -name '.git' -exec rm -rf {} \;"
+
+#application specific
+alias art='php artisan' #laravel
+alias srv='php artisan serve' #laravel
+alias tnk='php artisan tinker' #laravel
+alias gmig='php artisan generate:migration'
+alias gcon='php artisan generate:controller'
+alias gmod='php artisan generate:model'
+alias cc='./vendor/bin/codecept'
+alias ccr='./vendor/bin/codecept run'
+alias cca='./vendor/bin/codecept Acceptance'
+alias ccf='./vendor/bin/codecept Functional'
+alias ccu='./vendor/bin/codecept run Unit'
+
+#function aliases
+alias ghc=ghc
+alias grl=grl
+alias grln=grln
+alias gac=gac
+alias gacm=gacm
+alias gacd=gacd
+alias ggacm=gulpacm
+alias ggac=gulpac
+##functions
+ghc() {
+ git clone git@github.com:$1/$2
+}
+gac() {
+ git add -A && git commit -m "$1"
+}
+
+gacm() {
+ git add -A && git commit -m "$1" && git push origin master
+}
+gacd() {
+ git add -A && git commit -m "$1" && git push origin develop
+}
+
+gulpacm() {
+ gulp && git add -A && git commit -m "$1" && git push origin master
+}
+
+gulpac() {
+ gulp && git add -A && git commit -m "$1"
+}
+
+grl() {
+ grep -rl "$1" *
+}
diff --git a/scripts/environment.sh b/scripts/environment.sh
new file mode 100644
index 0000000..8b041ca
--- /dev/null
+++ b/scripts/environment.sh
@@ -0,0 +1,124 @@
+#! /bin/bash
+
+# Defaults:
+PHP_VERSION=5.6
+
+while [[ $# -gt 1 ]]; do
+key="$1"
+
+case "$key" in
+ --php-version)
+ PHP_VERSION="$2"
+ shift # past argument
+ ;;
+ *)
+ # unknown option
+ ;;
+esac
+shift # past argument or value
+done
+
+block="
+ server {
+ listen 80;
+
+ root /vagrant;
+ index index.html index.htm index.php;
+
+ # Make site accessible from ...
+ server_name flarum.dev 192.168.29.29.xip.io;
+
+ access_log /var/log/nginx/flarum-access.log;
+ error_log /var/log/nginx/flarum-error.log error;
+
+ charset utf-8;
+
+ location / {
+ try_files \$uri \$uri/ /index.php?\$query_string;
+ }
+
+ location /api {
+ try_files \$uri \$uri/ /api.php?\$query_string;
+ }
+
+ location /admin {
+ try_files \$uri \$uri/ /admin.php?\$query_string;
+ }
+
+ location = /favicon.ico { log_not_found off; access_log off; }
+ location = /robots.txt { access_log off; log_not_found off; }
+
+ # pass the PHP scripts to php5-fpm
+ # Note: .php$ is susceptible to file upload attacks
+ # Consider using: \"location ~ ^/(index|app|app_dev|config).php(/|$) {\"
+ location ~ \.php$ {
+ try_files \$uri =404;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ # With php-fpm:
+ fastcgi_pass unix:/run/php/php${PHP_VERSION}-fpm.sock;
+ fastcgi_index index.php;
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
+ fastcgi_param LARA_ENV local; # Environment variable for Laravel
+ fastcgi_param HTTP_PROXY \"\"; # Fix for https://httpoxy.org/ vulnerability
+ fastcgi_param HTTPS off;
+ }
+
+ # Deny .htaccess file access
+ location ~ /\.ht {
+ deny all;
+ }
+
+ location ~* \.html$ {
+ expires -1;
+ }
+
+ location ~* \.(css|js|gif|jpe?g|png)$ {
+ expires 1M;
+ add_header Pragma public;
+ add_header Cache-Control \"public, must-revalidate, proxy-revalidate\";
+ }
+
+ gzip on;
+ gzip_http_version 1.1;
+ gzip_vary on;
+ gzip_comp_level 6;
+ gzip_proxied any;
+ gzip_types application/atom+xml \
+ application/javascript \
+ application/json \
+ application/vnd.ms-fontobject \
+ application/x-font-ttf \
+ application/x-web-app-manifest+json \
+ application/xhtml+xml \
+ application/xml \
+ font/opentype \
+ image/svg+xml \
+ image/x-icon \
+ text/css \
+ text/html \
+ text/plain \
+ text/xml;
+ gzip_buffers 16 8k;
+ gzip_disable \"MSIE [1-6]\.(?!.*SV1)\";
+
+ }
+"
+
+echo "$block" | sudo tee /etc/nginx/sites-available/vagrant
+sudo service nginx restart
+
+### Setup NPM globals and create necessary directories ###
+sudo chown -R vagrant:vagrant /home/vagrant
+
+cp /vagrant/scripts/aliases ~/.aliases
+
+### Create rc file ###
+echo "source ~/.aliases" >> ~/.bashrc
+
+mysql -u root -proot -e 'create database if not exists flarum'
+
+cd /vagrant
+composer install --prefer-dist
+composer dump-autoload
+php flarum install --defaults