|
| 1 | +<?php |
| 2 | + |
| 3 | +$get_env = function (&$var, $default = null) { |
| 4 | + return !empty($var) ? $var : $default; |
| 5 | +}; |
| 6 | + |
| 7 | +//////////////////////////////////////////////////////////////////////////// |
| 8 | +// DATABASE CONFIG |
| 9 | + |
| 10 | +$COOKIE_STORE = $get_env(getenv("COOKIE_STORE"), '/tmp/siscookies.txt'); |
| 11 | +$DATABASE_SERVER = $get_env(getenv("DATABASE_SERVER"), 'mysql.csh.rit.edu'); |
| 12 | +$DATABASE_USER = $get_env(getenv("DATABASE_USER"), ''); |
| 13 | +$DATABASE_PASS = $get_env(getenv("DATABASE_PASS"), ''); |
| 14 | +$DATABASE_DB = $get_env(getenv("DATABASE_DB"), ''); |
| 15 | +$DUMPCLASSES = $get_env(getenv("DUMPCLASSES"), '/mnt/share/cshclass.dat'); |
| 16 | +$DUMPCLASSATTR = $get_env(getenv("DUMPCLASSATTR"), '/mnt/share/cshattrib.dat'); |
| 17 | +$DUMPINSTRUCT = $get_env(getenv("DUMPINSTRUCT"), '/mnt/share/cshinstr.dat'); |
| 18 | +$DUMPMEETING = $get_env(getenv("DUMPMEETING"), '/mnt/share/cshmtgpat.dat'); |
| 19 | +$DUMPNOTES = $get_env(getenv("DUMPNOTES"), '/mnt/share/cshnotes.dat'); |
| 20 | + |
| 21 | +$HTTPROOTADDRESS = $get_env(getenv("HTTPROOTADDRESS"), 'http://schedule.csh.rit.edu/'); |
| 22 | +$SERVER_TYPE = $get_env(getenv("SERVER_TYPE"), 'development'); |
| 23 | + |
| 24 | +//////////////////////////////////////////////////////////////////////////// |
| 25 | +//// APP VERSIONS |
| 26 | +$APP_CONFIG = json_decode(file_get_contents((empty($APP_ROOT)?"../":$APP_ROOT)."package.json"), true); |
| 27 | +$APP_VERSION = $APP_CONFIG['version']; |
| 28 | +$JSSTATE_VERSION = $APP_CONFIG['config']['stateVersion']; |
| 29 | + |
| 30 | + |
| 31 | +//////////////////////////////////////////////////////////////////////////// |
| 32 | +////// GOOGLE ANALYTICS |
| 33 | +//// |
| 34 | +$GOOGLEANALYTICS = ($SERVER_TYPE == 'production')? |
| 35 | + $get_env(getenv("GOOGLEANALYTICS1"), ''): |
| 36 | + $get_env(getenv("GOOGLEANALYTICS2"), ''); |
| 37 | +// |
| 38 | + |
| 39 | +//////////////////////////////////////////////////////////////////////////// |
| 40 | +// WORK AROUNDS |
| 41 | +if (get_magic_quotes_gpc()) { |
| 42 | + $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
| 43 | + while (list($key, $val) = each($process)) { |
| 44 | + foreach ($val as $k => $v) { |
| 45 | + unset($process[$key][$k]); |
| 46 | + if (is_array($v)) { |
| 47 | + $process[$key][stripslashes($k)] = $v; |
| 48 | + $process[] = &$process[$key][stripslashes($k)]; |
| 49 | + } else { |
| 50 | + $process[$key][stripslashes($k)] = stripslashes($v); |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + unset($process); |
| 55 | +} |
| 56 | +//////////////////////////////////////////////////////////////////////////// |
| 57 | +// CALCULATIONS |
| 58 | + |
| 59 | +// Calculate the current quarter |
| 60 | +switch(date('n')) { |
| 61 | + case 2: |
| 62 | + case 3: |
| 63 | + $CURRENT_QUARTER = date("Y")-1 . '3'; // Point them to the spring |
| 64 | + break; |
| 65 | + case 4: |
| 66 | + case 5: |
| 67 | + case 6: |
| 68 | + case 7: |
| 69 | + case 8: |
| 70 | + case 9: |
| 71 | + $CURRENT_QUARTER = date("Y") . '1'; // Point them to the fall |
| 72 | + break; |
| 73 | + case 10: |
| 74 | + case 11: |
| 75 | + case 12: |
| 76 | + case 1: |
| 77 | + $CURRENT_QUARTER = date("Y") . '2'; // Point them to the summer |
| 78 | + break; |
| 79 | +} |
| 80 | + |
0 commit comments