diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c1a549c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM php:7.1-apache +MAINTAINER Devin Matte + +ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf + +RUN a2enmod rewrite && a2enmod headers && a2enmod expires && \ + sed -i '/Listen/{s/\([0-9]\+\)/8080/; :a;n; ba}' /etc/apache2/ports.conf && \ + chmod og+rwx /var/lock/apache2 && chmod -R og+rwx /var/run/apache2 + +RUN apt-get -yq update && \ + apt-get -yq install gnupg libmagickwand-dev --no-install-recommends && \ + apt-get -yq clean all + +RUN docker-php-ext-install mysqli && \ + pecl install imagick && docker-php-ext-enable imagick + +COPY . /var/www/html + +RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ + apt-get -yq update && \ + apt-get -yq install nodejs && \ + npm install && \ + npm run-script build && \ + rm -rf node_modules && \ + apt-get -yq remove nodejs && \ + apt-get -yq clean all + +EXPOSE 8080 +EXPOSE 8443 diff --git a/apache-config.conf b/apache-config.conf new file mode 100644 index 0000000..c1bc66a --- /dev/null +++ b/apache-config.conf @@ -0,0 +1,15 @@ + + ServerAdmin webmaster@csh.rit.edu + DocumentRoot /var/www/html + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order deny,allow + Allow from all + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + diff --git a/api/entity.php b/api/entity.php index d34b828..7744e3d 100644 --- a/api/entity.php +++ b/api/entity.php @@ -10,7 +10,11 @@ //////////////////////////////////////////////////////////////////////////// // REQUIRED FILES ////////////////////////////////////////////////////////// -require_once "../inc/config.php"; +if (file_exists('../inc/config.php')) { + require_once "../inc/config.php"; +} else { + require_once "../inc/config.env.php"; +} require_once "../inc/databaseConn.php"; require_once "../inc/timeFunctions.php"; require_once "../inc/ajaxError.php"; diff --git a/api/generate.php b/api/generate.php index f08c0a9..d192d9c 100644 --- a/api/generate.php +++ b/api/generate.php @@ -10,7 +10,11 @@ //////////////////////////////////////////////////////////////////////////// // REQUIRED FILES -require_once "../inc/config.php"; +if (file_exists('../inc/config.php')) { + require_once "../inc/config.php"; +} else { + require_once "../inc/config.env.php"; +} require_once "../inc/databaseConn.php"; require_once "../inc/timeFunctions.php"; require_once "../inc/ajaxError.php"; diff --git a/api/schedule.php b/api/schedule.php index 07ad92d..c3c1c14 100644 --- a/api/schedule.php +++ b/api/schedule.php @@ -9,7 +9,11 @@ //////////////////////////////////////////////////////////////////////////// // REQUIRED FILES ////////////////////////////////////////////////////////// -require_once('../inc/config.php'); +if (file_exists('../inc/config.php')) { + require_once "../inc/config.php"; +} else { + require_once "../inc/config.env.php"; +} require_once('../inc/databaseConn.php'); require_once('../inc/timeFunctions.php'); diff --git a/api/search.php b/api/search.php index 7841702..da9782d 100644 --- a/api/search.php +++ b/api/search.php @@ -25,7 +25,11 @@ function assertNumeric($var, $name) { } // REQUIRED FILES ////////////////////////////////////////////////////////// -require_once "../inc/config.php"; +if (file_exists('../inc/config.php')) { + require_once "../inc/config.php"; +} else { + require_once "../inc/config.env.php"; +} require_once "../inc/databaseConn.php"; require_once "../inc/timeFunctions.php"; require_once "../inc/ajaxError.php"; diff --git a/assets/src/modules/sm/Schedule/directives/scheduleActionsDirective.js b/assets/src/modules/sm/Schedule/directives/scheduleActionsDirective.js index 923f5fa..99ae36d 100644 --- a/assets/src/modules/sm/Schedule/directives/scheduleActionsDirective.js +++ b/assets/src/modules/sm/Schedule/directives/scheduleActionsDirective.js @@ -169,4 +169,4 @@ angular.module('sm').directive('scheduleActions', function($http, $q, shareServi pre: scheduleActions } }; -}); \ No newline at end of file +}); diff --git a/img/schedules/readme.txt b/img/schedules/readme.txt deleted file mode 100644 index d7adecd..0000000 --- a/img/schedules/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -Images stored in this folder will 1:1 correspond to the id of the schedule they -represent. The images are generated via ImageMagick, so it is imperative that ImageMagick -be installed on the web server. - -This folder should have write permissions for the user that is running the web server. - -(The true reason for this file is to make sure this directory gets committed) \ No newline at end of file diff --git a/inc/config.env.php b/inc/config.env.php new file mode 100644 index 0000000..e5b5ab5 --- /dev/null +++ b/inc/config.env.php @@ -0,0 +1,80 @@ + $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][stripslashes($k)] = $v; + $process[] = &$process[$key][stripslashes($k)]; + } else { + $process[$key][stripslashes($k)] = stripslashes($v); + } + } + } + unset($process); +} +//////////////////////////////////////////////////////////////////////////// +// CALCULATIONS + +// Calculate the current quarter +switch(date('n')) { + case 2: + case 3: + $CURRENT_QUARTER = date("Y")-1 . '3'; // Point them to the spring + break; + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + $CURRENT_QUARTER = date("Y") . '1'; // Point them to the fall + break; + case 10: + case 11: + case 12: + case 1: + $CURRENT_QUARTER = date("Y") . '2'; // Point them to the summer + break; +} + diff --git a/inc/databaseConn.php b/inc/databaseConn.php index 3cad8e9..66455dd 100644 --- a/inc/databaseConn.php +++ b/inc/databaseConn.php @@ -9,7 +9,11 @@ //////////////////////////////////////////////////////////////////////////// // Bring in the config data -require_once dirname(__FILE__) . "/config.php"; +if (file_exists(dirname(__FILE__) . "/config.php")) { + require_once dirname(__FILE__) . "/config.php"; +} else { + require_once dirname(__FILE__) . "/config.env.php"; +} // There is no better place to put this, as all pages require this file. diff --git a/index.php b/index.php index 54933e9..bd45f25 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,11 @@ // REQUIRED FILES $APP_ROOT = "./"; -require_once('./inc/config.php'); +if (file_exists('./inc/config.php')) { + require_once('./inc/config.php'); +} else { + require_once('./inc/config.env.php'); +} require_once('./inc/databaseConn.php'); require_once('./inc/timeFunctions.php');