123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- <?php
- /**
- * <https://y.st./>
- * Copyright © 2016 //y.st. <mailto:copyright@y.st>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org./licenses/>.
- **/
- /**
- * It got to be too difficult keeping track of variable names
- * throughout this website's source code to prevent variable name
- * clashes. All variables are either declared in this file now or have
- * names that are reserved by the comments in this file. That way, new
- * variable names need only be checked against the variable names from
- * this file instead of checked against variable names from every file
- * of this project.
- **/
- use st\y\abbr, st\y\day_number;
- // Objects:
- $a = abbr::construct_from_file(__DIR__.'/abbr.txt');
- $entry = new day_number(2015, 3, 7);
- // In-string alias:
- $syntax = '\\st\\y\\highlight_string';
- // Please note that for signatures to be effective, I cannot give you my key.
- // If you want to compile the site on your own machine, you will need to edit the PGP lines here.
- $pgp = new gnupg;
- $pgp->addsignkey('D135B061DBED690B479FE2E37D83E1E5E7464A03');
- // These intervals are used in the navigation menus.
- $interval = array(
- 'year' => new DateInterval('P1Y'),
- 'month' => new DateInterval('P1M'),
- 'day' => new DateInterval('P1D'),
- );
- // When compiling the weblog navigation, it would be helpful to know when the latest entry is.
- $latest_entry = array(
- 'year' => '',
- 'month' => '',
- 'day' => '',
- );
- foreach(scandir(__DIR__.'/pages/en/weblog') as $year):
- if($year > $latest_entry['year']):
- $latest_entry['year'] = $year;
- endif;
- endforeach;
- foreach(scandir(__DIR__."/pages/en/weblog/$latest_entry[year]") as $month):
- if($month > $latest_entry['month']):
- $latest_entry['month'] = $month;
- endif;
- endforeach;
- foreach(scandir(__DIR__."/pages/en/weblog/$latest_entry[year]/$latest_entry[month]") as $day):
- if($day > $latest_entry['day']):
- $latest_entry['day'] = $day;
- endif;
- endforeach;
- $latest_copyright_year = $latest_entry['year'];
- $latest_entry = array(
- 'year' => "/en/weblog/$latest_entry[year]/",
- 'month' => "/en/weblog/$latest_entry[year]/$latest_entry[month]/",
- 'day' => "/en/weblog/$latest_entry[year]/$latest_entry[month]/$latest_entry[day]",
- );
- // This is just to catch invalid arguments
- $valid_arguments = array(
- '--canary',
- );
- foreach($argv as $key => $value):
- // The "and $key" part prevents the script from treating the file name as an invalid argument.
- // $argv[0] will always be the file name and 0 evaluates to false.
- if(!in_array($value, $valid_arguments) and $key):
- $invalid_arguments[] = $value;
- endif;
- endforeach;
- // This array includes the names of all files that should not be
- // deleted from the compiled version of the website. Any page that
- // still has source code should have an entry in this array. If a page
- // is removed from the source code, it shouldn't be added to this array
- // during compilation time, which will result in that page being
- // removed from the compiled version. That way, we can recompile the
- // website without keeping pages that should be removed and without
- // erasing all already-compiled pages from disk before compiling them
- // if their source code hasn't been modified.
- $should_exist = array();
- // Used by the ASCII calendar pages:
- $months = array(
- 1 => '01-January',
- 2 => '02-February',
- 3 => '03-March',
- 4 => '04-April',
- 5 => '05-May',
- 6 => '06-June',
- 7 => '07-July',
- 8 => '08-August',
- 9 => '09-September',
- 10 => '10-October',
- 11 => '11-November',
- 12 => '12-December',
- );
- $monthheads = array(
- 1 => ' January',
- 2 => ' February',
- 3 => ' March',
- 4 => ' April',
- 5 => ' May',
- 6 => ' June',
- 7 => ' July',
- 8 => ' August',
- 9 => 'September',
- 10 => ' October',
- 11 => ' November',
- 12 => ' December',
- );
- // Previously, when I added new assignment submissions to my list of
- // coursework, I had to manually update both the coursework index and
- // the navigation menu of the course that the assignment was for. With
- // this array, I can now instead only update in one place instead of
- // two.
- $coursework = array(
- 'BUS1101' => array(
- 'title' => 'BUS 1101: Principles of Business Management',
- 'subtitle' => "<span title=\"{$entry(2016, 11, 10)}\">2016-11-10</span> to <span title=\"{$entry(2017, 1, 11)}\">2017-01-11</span>",
- 'assignments' => array(
- 'Leadership_Entrepreneurship_and_Strategy' => array(
- 'title' => 'Leadership, Entrepreneurship, and Strategy',
- 'unit' => '1',
- ),
- 'Behavior_management_at_the_SAS_Institute' => array(
- 'title' => 'Behavior management at the SAS Institute',
- 'unit' => '2',
- ),
- 'How_Coca-Cola_should_deal_with_globalization' => array(
- 'title' => 'How Coca-Cola should deal with globalization',
- 'unit' => '3',
- ),
- 'SCAMPER' => array(
- 'title' => 'SCAMPER',
- 'unit' => '4',
- ),
- 'Strengths_weaknesses_opportunities_and_threats' => array(
- 'title' => 'Strengths, weaknesses, opportunities, and threats',
- 'unit' => '5',
- ),
- 'Microsoft_and_corporate_social_responsibility' => array(
- 'title' => 'Microsoft and corporate social responsibility',
- 'unit' => '6',
- ),
- 'Three_types_of_organizational_structures' => array(
- 'title' => 'Three types of organizational structures',
- 'unit' => '7',
- ),
- 'Little_Caesars_culture' => array(
- 'title' => 'Little Caesars culture',
- 'unit' => '8',
- ),
- ),
- ),
- 'CS1101' => array(
- 'title' => 'CS 1101: Programming Fundamentals',
- 'subtitle' => "<span title=\"{$entry(2017, 1, 26)}\">2017-01-26</span> to <span title=\"{$entry(2017, 3, 29)}\">2017-03-29</span>",
- 'assignments' => array(
- 't_area.py' => array(
- 'title' => 't_area.py',
- 'unit' => '2',
- ),
- 'calculator_flowchart' => array(
- 'title' => 'calculator flowchart',
- 'unit' => '3',
- ),
- 'tryme3.py' => array(
- 'title' => 'tryme3.py',
- 'unit' => '4',
- ),
- 'mycalc.py' => array(
- 'title' => 'mycalc.py',
- 'unit' => '5',
- ),
- 'bool.py' => array(
- 'title' => 'bool.py',
- 'unit' => '6',
- ),
- 'sort_fruits.py' => array(
- 'title' => 'sort_fruits.py',
- 'unit' => '7',
- ),
- ),
- ),
- 'CS1102' => array(
- 'title' => 'CS 1102: Programming 1',
- 'subtitle' => "<span title=\"{$entry(2017, 4, 6)}\">2017-04-06</span> to <span title=\"{$entry(2017, 6, 7)}\">2017-06-07</span>",
- 'assignments' => array(
- 'GravityCalculator.java' => array(
- 'title' => 'GravityCalculator.java',
- 'unit' => '1',
- ),
- 'SnakeEyesCount.java' => array(
- 'title' => 'SnakeEyesCount.java',
- 'unit' => '2',
- ),
- 'Unit3.java' => array(
- 'title' => 'Unit3.java',
- 'unit' => '3',
- ),
- 'firstsubroutines.java' => array(
- 'title' => 'firstsubroutines.java',
- 'unit' => '4',
- ),
- 'Unit5.java' => array(
- 'title' => 'Unit5.java',
- 'unit' => '5',
- ),
- 'payrollsystem' => array(
- 'title' => 'package payrollsystem;',
- 'unit' => '7',
- ),
- 'matchbox' => array(
- 'title' => 'package matchbox;',
- 'unit' => '6',
- ),
- 'Unit7.java' => array(
- 'title' => 'Unit7.java',
- 'unit' => '7',
- ),
- ),
- ),
- 'CS1103' => array(
- 'title' => 'CS 1103: Programming 2',
- 'subtitle' => "<span title=\"{$entry(2017, 6, 15)}\">2017-06-15</span> to <span title=\"{$entry(2017, 8, 16)}\">2017-08-16</span>",
- 'assignments' => array(
- 'Unit1.java' => array(
- 'title' => 'Unit1.java',
- 'unit' => '1',
- ),
- 'SimpleRandomSentences.java' => array(
- 'title' => 'SimpleRandomSentences.java',
- 'unit' => '2',
- ),
- 'Tape.java' => array(
- 'title' => 'Tape.java',
- 'unit' => '3',
- ),
- 'Debugging' => array(
- 'title' => 'Debugging',
- 'unit' => '4',
- ),
- 'Unit5.java' => array(
- 'title' => 'Unit5.java',
- 'unit' => '5',
- ),
- 'DrawTextPanel.java' => array(
- 'title' => 'DrawTextPanel.java',
- 'unit' => '6',
- ),
- 'Unit7.java' => array(
- 'title' => 'Unit7.java',
- 'unit' => '7',
- ),
- ),
- ),
- 'CS2203' => array(
- 'title' => 'CS 2203: Databases 1',
- 'subtitle' => "<span title=\"{$entry(2017, 6, 15)}\">2017-06-15</span> to <span title=\"{$entry(2017, 8, 16)}\">2017-08-16</span>",
- 'assignments' => array(
- 'Library_database_relations' => array(
- 'title' => 'Library database relations',
- 'unit' => '1',
- ),
- 'Library_database_relations~_continued' => array(
- 'title' => 'Library database relations, continued',
- 'unit' => '2',
- ),
- 'Library_database_relation_diagram' => array(
- 'title' => 'Library database relation diagram',
- 'unit' => '3',
- ),
- 'Library_database_normalisation' => array(
- 'title' => 'Library database normalisation',
- 'unit' => '4',
- ),
- 'Library_database_SQL' => array(
- 'title' => 'Library database SQL',
- 'unit' => '5',
- ),
- 'Library_database_SQL~_continued' => array(
- 'title' => 'Library database SQL, continued',
- 'unit' => '6',
- ),
- 'Library_database_SQL_select' => array(
- 'title' => 'Library database SQL select',
- 'unit' => '7',
- ),
- ),
- ),
- 'CS2205' => array(
- 'title' => 'CS 2205: Web Programming 1',
- 'subtitle' => "<span title=\"{$entry(2017, 9, 7)}\">2017-09-07</span> to <span title=\"{$entry(2017, 11, 8)}\">2017-11-08</span>",
- 'assignments' => array(
- 'Markup_validation' => array(
- 'title' => 'Markup validation',
- 'unit' => '1',
- ),
- ),
- ),
- 'CS2301' => array(
- 'title' => 'CS 2301: Operating Systems 1',
- 'subtitle' => "<span title=\"{$entry(2017, 9, 7)}\">2017-09-07</span> to <span title=\"{$entry(2017, 11, 8)}\">2017-11-08</span>",
- 'assignments' => array(),
- ),
- 'HIST1421' => array(
- 'title' => 'HIST 1421: Greek and Roman Civilization',
- 'subtitle' => "<span title=\"{$entry(2017, 4, 6)}\">2017-04-06</span> to <span title=\"{$entry(2017, 6, 7)}\">2017-06-07</span>",
- 'assignments' => array(
- 'Politics_in_Athens_and_Sparta' => array(
- 'title' => 'Politics in Athens and Sparta',
- 'unit' => '1',
- ),
- 'Forms_of_government_in_ancient_Greece' => array(
- 'title' => 'Forms of government in ancient Greece',
- 'unit' => '2',
- ),
- 'Inequalities_in_Rome' => array(
- 'title' => 'Inequalities in Rome',
- 'unit' => '4',
- ),
- 'The_first_Punic_war' => array(
- 'title' => 'The first Punic war',
- 'unit' => '5',
- ),
- 'Concrete_and_arches' => array(
- 'title' => 'Concrete and arches',
- 'unit' => '7',
- ),
- ),
- ),
- 'PHIL1404' => array(
- 'title' => 'PHIL 1404: Ethics and Social Responsibility',
- 'subtitle' => "<span title=\"{$entry(2017, 1, 26)}\">2017-01-26</span> to <span title=\"{$entry(2017, 3, 29)}\">2017-03-29</span>",
- 'assignments' => array(
- 'Apple_and_ethics' => array(
- 'title' => 'Apple and ethics',
- 'unit' => '1',
- ),
- 'Cultural_relativism' => array(
- 'title' => 'Cultural relativism',
- 'unit' => '3',
- ),
- 'Artificial_value' => array(
- 'title' => 'Artificial value',
- 'unit' => '5',
- ),
- 'Caveat_emptor_and_the_McDonald~s_coffee_case' => array(
- 'title' => 'Caveat emptor and the McDonald's coffee case',
- 'unit' => '7',
- ),
- ),
- ),
- 'POLS1503' => array(
- 'title' => 'POLS 1503: Globalization',
- 'subtitle' => "<span title=\"{$entry(2016, 9, 1)}\">2016-09-01</span> to <span title=\"{$entry(2016, 11, 2)}\">2016-11-02</span>",
- 'assignments' => array(
- 'The_World_Bank_and_the_Integrated_Storm_Water_Drain_project_in_Chennai' => array(
- 'title' => 'The World Bank and the Integrated Storm Water Drain project in Chennai',
- 'unit' => '2',
- ),
- 'The_Electronic_Frontier_Foundation' => array(
- 'title' => 'The Electronic Frontier Foundation',
- 'unit' => '3',
- ),
- 'The_Canadian_Magazine_Dispute_and_an_Exemption_for_Whaling' => array(
- 'title' => 'The Canadian Magazine Dispute and an Exemption for Whaling',
- 'unit' => '6',
- ),
- 'Global_pathogens_and_GMOs' => array(
- 'title' => 'Global pathogens and GMOs',
- 'unit' => '7',
- ),
- ),
- ),
- 'UNIV1001' => array(
- 'title' => 'UNIV 1001: Online Education Strategies',
- 'subtitle' => "<span title=\"{$entry(2016, 9, 1)}\">2016-09-01</span> to <span title=\"{$entry(2016, 11, 2)}\">2016-11-02</span>",
- 'assignments' => array(
- 'Free_Business_Models_and_Why_They_Matter_to_Me' => array(
- 'title' => 'Free Business Models and Why They Matter to Me',
- 'unit' => '2',
- ),
- 'Proctoring' => array(
- 'title' => 'Proctoring',
- 'unit' => '3',
- ),
- 'Student_Success' => array(
- 'title' => 'Student Success',
- 'unit' => '4',
- ),
- 'Notes' => array(
- 'title' => 'Notes',
- 'unit' => '6',
- ),
- 'A_conflict_with_T-Mobile' => array(
- 'title' => 'A conflict with T-Mobile',
- 'unit' => '7',
- ),
- ),
- ),
- );
- // Automated navigation menu for the coursework section
- foreach($coursework as $key_code => $value_array):
- $assignment_array = array();
- foreach($value_array['assignments'] as $key_href => $value_assignment):
- $assignment_array[] = "<a href=\"/en/coursework/$key_code/$key_href.xhtml\" title=\"{$value_assignment['title']}\">Unit {$value_assignment['unit']}</a>";
- endforeach;
- $coursework_nav[$key_code] = implode(" |\n\t\t\t\t", $assignment_array);
- endforeach;
- unset($key_code, $value_array, $assignment_array, $key_href, $value_assignment);
- // The following variable names are reserved, and may be declared in
- // in any file. However, because they can be declared in any file, they
- // cannot be assumed in any file to be empty before use.
- //
- // $key and variable names beginning in "$key_":
- // Reserved for use in "foreach" statements.
- // $value and variable names beginning in "$value_":
- // Reserved for use in "foreach" statements.
- // $i:
- // Reserved for use in "for" statements.
- // $canary:
- // Currently used by the main build script to contain the warrant
- // canary's contents.
- // $dirname:
- // Used in any file to refer to the name of a directory that needs
- // to be checked for existence, then created if nonexistent. (This
- // should be fixed with a function at some point.)
- // $moved:
- // Currently used in the file dealing with redirect pages.
- // $_:
- // Used when a value is required to be assigned to a variable, but
- // we have no intention of actually reading that variable's value.
- // $current_entry:
- // Used in some of the weblog-specific code to hold the year,
- // month, and day numbers. This code may need to be rewritten once
- // path-specific code has been set up.
- // $datetime:
- // Used in some navigation code that needs to be cleaned up.
- // $previous:
- // Used in some navigation code that needs to be cleaned up.
- // $next:
- // Used in some navigation code that needs to be cleaned up.
- // $URI_path_minus_slash:
- // Set to the HTTP path of the webpage, minus the slash at the
- // beginning.
- // $xhtml:
- // An array of page-specific variables used by the main template.
- // $checkpath:
- // A variable used on the main template to build the links to the
- // XHTML/CSS conformance checker. This code should probably be
- // cleaned up.
- // $time_script_started:
- // This variable holds the time that the script started, for
- // statistical purposes. It can't be declared in this file simply
- // because it needs to be declared before this file is require()d.
- // $time_until_script_ended:
- // This variable holds the time that the script took to complete,
- // for statistical purposes. It can't be declared in this file
- // simply because it needs to be declared at the end of the main
- // script.
- // NOTES:
- // "weblog_index.php" majorly needs to be cleaned up later.
- //
- // Closures are also not included in this file. All variable names
- // beginning in "$¢" are reserved for use as closures.
|