Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:7.1-apache
MAINTAINER Devin Matte <matted@csh.rit.edu>

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
15 changes: 15 additions & 0 deletions apache-config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VirtualHost *:8080>
ServerAdmin webmaster@csh.rit.edu
DocumentRoot /var/www/html

<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
6 changes: 5 additions & 1 deletion api/entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 5 additions & 1 deletion api/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 5 additions & 1 deletion api/schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
6 changes: 5 additions & 1 deletion api/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ angular.module('sm').directive('scheduleActions', function($http, $q, shareServi
pre: scheduleActions
}
};
});
});
7 changes: 0 additions & 7 deletions img/schedules/readme.txt

This file was deleted.

80 changes: 80 additions & 0 deletions inc/config.env.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

$get_env = function (&$var, $default = null) {
return !empty($var) ? $var : $default;
};

////////////////////////////////////////////////////////////////////////////
// DATABASE CONFIG

$COOKIE_STORE = $get_env(getenv("COOKIE_STORE"), '/tmp/siscookies.txt');
$DATABASE_SERVER = $get_env(getenv("DATABASE_SERVER"), 'mysql.csh.rit.edu');
$DATABASE_USER = $get_env(getenv("DATABASE_USER"), '');
$DATABASE_PASS = $get_env(getenv("DATABASE_PASS"), '');
$DATABASE_DB = $get_env(getenv("DATABASE_DB"), '');
$DUMPCLASSES = $get_env(getenv("DUMPCLASSES"), '/mnt/share/cshclass.dat');
$DUMPCLASSATTR = $get_env(getenv("DUMPCLASSATTR"), '/mnt/share/cshattrib.dat');
$DUMPINSTRUCT = $get_env(getenv("DUMPINSTRUCT"), '/mnt/share/cshinstr.dat');
$DUMPMEETING = $get_env(getenv("DUMPMEETING"), '/mnt/share/cshmtgpat.dat');
$DUMPNOTES = $get_env(getenv("DUMPNOTES"), '/mnt/share/cshnotes.dat');

$HTTPROOTADDRESS = $get_env(getenv("HTTPROOTADDRESS"), 'http://schedule.csh.rit.edu/');
$SERVER_TYPE = $get_env(getenv("SERVER_TYPE"), 'development');

////////////////////////////////////////////////////////////////////////////
//// APP VERSIONS
$APP_CONFIG = json_decode(file_get_contents((empty($APP_ROOT)?"../":$APP_ROOT)."package.json"), true);
$APP_VERSION = $APP_CONFIG['version'];
$JSSTATE_VERSION = $APP_CONFIG['config']['stateVersion'];


////////////////////////////////////////////////////////////////////////////
////// GOOGLE ANALYTICS
////
$GOOGLEANALYTICS = ($SERVER_TYPE == 'production')?
$get_env(getenv("GOOGLEANALYTICS1"), ''):
$get_env(getenv("GOOGLEANALYTICS2"), '');
//

////////////////////////////////////////////////////////////////////////////
// WORK AROUNDS
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $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;
}

6 changes: 5 additions & 1 deletion inc/databaseConn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down