├── .dockerignore ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .yarnrc ├── COPYING ├── CREDITS ├── Dockerfile ├── Dockerfile-db-init ├── INSTALL.md ├── README.md ├── about.php ├── addons-menu.php ├── addons-panel.php ├── addons.php ├── api ├── .htaccess ├── index.php ├── server.php └── user.php ├── assets ├── .htaccess ├── cache │ └── .gitignore ├── css │ └── main.css ├── dtd │ └── news.dtd ├── fonts │ ├── DejaVuSans.ttf │ └── OpenSans.woff ├── img │ ├── background.jpg │ ├── emblem-favorite.png │ ├── favicon │ │ ├── favicon-114.png │ │ ├── favicon-120.png │ │ ├── favicon-144.png │ │ ├── favicon-150.png │ │ ├── favicon-152.png │ │ ├── favicon-16.png │ │ ├── favicon-160.png │ │ ├── favicon-180.png │ │ ├── favicon-192.png │ │ ├── favicon-310.png │ │ ├── favicon-32.png │ │ ├── favicon-57.png │ │ ├── favicon-60.png │ │ ├── favicon-64.png │ │ ├── favicon-70.png │ │ ├── favicon-72.png │ │ ├── favicon-76.png │ │ └── favicon-96.png │ ├── flags.png │ ├── flags.svg │ ├── home-icons.png │ ├── home-icons.xcf │ ├── index-icons.png │ ├── kart-icon.png │ ├── karts-small.png │ ├── loader.gif │ ├── logo.png │ ├── logo_large.png │ ├── logo_small.png │ ├── news-panel.png │ ├── notfound.png │ ├── notfound.svg │ ├── sad-tux.png │ ├── stars.png │ ├── track-icon.png │ ├── tracks-small.png │ └── user.png ├── js │ ├── addon.js │ ├── bugs.js │ ├── jquery.newsticker.js │ ├── main.js │ ├── manage.js │ ├── stats.js │ ├── upload.js │ ├── user.js │ └── util.js └── libs │ └── .gitignore ├── bugs ├── add.php ├── all.php ├── index.php └── view.php ├── composer.json ├── composer.lock ├── cron ├── .htaccess ├── daily.php ├── hourly.php ├── src │ ├── DailyCron.php │ ├── HourlyCron.php │ └── WeeklyCron.php └── weekly.php ├── dl ├── .gitignore ├── images │ └── .gitignore └── xml │ └── .gitignore ├── docker-compose.dev.yml ├── docker-compose.yml ├── docker-tools ├── init-db.sh └── wait-for-it.sh ├── download.php ├── downloads ├── error.php ├── favicon.ico ├── image.php ├── include ├── AccessControl.class.php ├── Achievement.class.php ├── Addon.class.php ├── AddonViewer.class.php ├── Aliases.class.php ├── Base.class.php ├── Bug.class.php ├── Cache.class.php ├── ClientSession.class.php ├── Config.class.php ├── DBConnection.class.php ├── Debug.class.php ├── Exceptions.class.php ├── File.class.php ├── FileSystem.class.php ├── Friend.class.php ├── IAsXML.php ├── Music.class.php ├── News.class.php ├── PaginationTemplate.class.php ├── Ranking.class.php ├── Rating.class.php ├── Server.class.php ├── Session.class.php ├── Statistic.class.php ├── StkImage.class.php ├── StkLocale.class.php ├── StkLog.class.php ├── StkMail.class.php ├── StkTemplate.class.php ├── Template.class.php ├── URL.class.php ├── Upload.class.php ├── User.class.php ├── Util.class.php ├── Validate.class.php ├── Verification.class.php ├── XMLOutput.class.php ├── functions.php ├── parsers │ ├── AddonXMLParser.class.php │ ├── B3DParser.class.php │ ├── Parser.class.php │ └── SPMParser.class.php └── xmlWrite.php ├── index.php ├── install ├── apache.EXAMPLE.conf ├── config.EXAMPLE.php ├── htaccess.EXAMPLE ├── index.php ├── install.sql ├── nginx.EXAMPLE.conf └── uninstall.sql ├── json ├── addons.php ├── bugs.php ├── image_list.php ├── license.php ├── manage.php ├── rating.php ├── search.php └── users.php ├── locale ├── ca_ES │ └── LC_MESSAGES │ │ └── translations.mo ├── de_DE │ └── LC_MESSAGES │ │ └── translations.mo ├── es_ES │ └── LC_MESSAGES │ │ └── translations.mo ├── eu_ES │ └── LC_MESSAGES │ │ └── translations.mo ├── fr_FR │ └── LC_MESSAGES │ │ └── translations.mo ├── ga_IE │ └── LC_MESSAGES │ │ └── translations.mo ├── gd_GB │ └── LC_MESSAGES │ │ └── translations.mo ├── generate-mo.sh ├── gl_ES │ └── LC_MESSAGES │ │ └── translations.mo ├── hu_HU │ └── LC_MESSAGES │ │ └── translations.mo ├── id_ID │ └── LC_MESSAGES │ │ └── translations.mo ├── it_IT │ └── LC_MESSAGES │ │ └── translations.mo ├── locale-gen.sh ├── nl_NL │ └── LC_MESSAGES │ │ └── translations.mo ├── pt_BR │ └── LC_MESSAGES │ │ └── translations.mo ├── ru_RU │ └── LC_MESSAGES │ │ └── translations.mo ├── translations-ca.po ├── translations-de.po ├── translations-es.po ├── translations-eu.po ├── translations-fr.po ├── translations-ga.po ├── translations-gd.po ├── translations-gl.po ├── translations-hu.po ├── translations-id.po ├── translations-it.po ├── translations-nl.po ├── translations-pt_BR.po ├── translations-ru.po ├── translations-zh_TW.po ├── translations.pot ├── update-pot.sh └── zh_TW │ └── LC_MESSAGES │ └── translations.mo ├── login.php ├── manage-panel.php ├── manage.php ├── music.php ├── package.json ├── password-reset.php ├── phpcs ├── Sniffs │ └── ControlSignatureSniff.php └── ruleset.xml ├── phpstan ├── config.example_install_for_phpstan.php └── config.phpstan.neon ├── phpunit.xml ├── privacy.php ├── rankings.php ├── register.php ├── stats ├── addons.php ├── clients.php ├── files.php ├── index.php ├── overview.php └── servers.php ├── tests ├── .htaccess ├── bootstrap.php └── include │ ├── AddonTest.php │ ├── CacheTest.php │ ├── DBExceptionTest.php │ ├── ExceptionsTest.php │ ├── StkImageTest.php │ ├── URLTest.php │ ├── UserTest.php │ ├── UtilTest.php │ └── ValidateTest.php ├── tools ├── .htaccess ├── cli.php ├── convert-db-v2-to-v3.php ├── dev-docker-run.sh ├── dev-precommit.sh ├── generate-ip-mappings.py ├── generate-xml.php ├── get-achievements.php ├── production-install-all.sh ├── production-install-composer.sh ├── production-install-yarn.sh ├── production-update-all.sh ├── production-update-composer.sh └── production-update-yarn.sh ├── tpl └── default │ ├── about.tpl │ ├── addons │ ├── index.tpl │ ├── menu.tpl │ ├── panel.tpl │ └── rating.tpl │ ├── bugs │ ├── add.tpl │ ├── all.tpl │ ├── index.tpl │ ├── view-comment.tpl │ └── view.tpl │ ├── email │ └── action.tpl │ ├── error-page.tpl │ ├── feedback │ ├── all.tpl │ ├── errors.tpl │ ├── success.tpl │ └── warnings.tpl │ ├── footer.tpl │ ├── header.tpl │ ├── index.tpl │ ├── login.tpl │ ├── maintenance.html │ ├── manage │ ├── index.tpl │ └── page │ │ ├── cache.tpl │ │ ├── clients.tpl │ │ ├── files.tpl │ │ ├── general.tpl │ │ ├── logs.tpl │ │ ├── news.tpl │ │ ├── overview.tpl │ │ └── roles.tpl │ ├── menu-lang.tpl │ ├── menu-top.tpl │ ├── music-browser.tpl │ ├── pagination │ ├── inner-for.tpl │ └── template.tpl │ ├── password-reset.tpl │ ├── privacy.tpl │ ├── rankings.tpl │ ├── register.tpl │ ├── stats │ ├── chart.tpl │ ├── index.tpl │ ├── page │ │ ├── addons.tpl │ │ ├── clients.tpl │ │ ├── files.tpl │ │ ├── overview.tpl │ │ └── servers.tpl │ └── section.tpl │ ├── upload.tpl │ └── users │ ├── index.tpl │ ├── menu.tpl │ ├── panel.tpl │ └── tab │ ├── achievements.tpl │ ├── friends.tpl │ ├── profile.tpl │ └── settings.tpl ├── upload.php ├── users-menu.php ├── users-panel.php ├── users.php └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | *.patch 3 | *.diff 4 | assets/libs 5 | phpstan 6 | tests 7 | vendor 8 | node_modules/ 9 | locale/file-list.txt 10 | 11 | # STK client files 12 | *.spm 13 | *.b3d -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | *.patch 3 | *.diff 4 | .directory 5 | *~ 6 | *.swp 7 | *.swo 8 | /.htaccess 9 | .idea/ 10 | vendor/ 11 | node_modules/ 12 | locale/file-list.txt 13 | 14 | 15 | yarn-error.log 16 | 17 | # STK client files 18 | *.spm 19 | *.b3d 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.2 5 | - 7.3 6 | 7 | script: 8 | - ./vendor/bin/phpunit --configuration phpunit.xml 9 | - composer phpstan 10 | - composer phpcs 11 | 12 | before_script: 13 | - composer self-update 14 | - composer install 15 | 16 | #notifications: 17 | # irc: 18 | # channels: 19 | # - "irc.freenode.org#supertuxkart" 20 | # skip_join: false 21 | # use_notice: true 22 | # template: 23 | # - "[%{repository}#%{branch} @%{commit}] %{author}): %{message}" 24 | # - "Diff: %{compare_url}" 25 | # - "Build: %{build_url}" 26 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | --modules-folder assets/libs 2 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | == Code == 2 | Stephen Just (sj04736) 3 | Glenn De Jonghe (unitraxx) 4 | Daniel Butum (leyyin) 5 | Lucas Baudin (xapantu) 6 | riebl 7 | 8 | == Translations == 9 | Adrián Chaves Fernández (gallaecio) 10 | Asier Iturralde Sarasola 11 | Auria 12 | asciimonster 13 | Bendetto 14 | Bill (cges30901) 15 | Crendgrim 16 | Daniel Winzen 17 | Douglas Moura 18 | Eduardo Alberto Calvo 19 | Fábio Nogueira 20 | GunChleoc 21 | Jens Maucher 22 | Jens O. John 23 | Jf. Tasz 24 | KroArtem 25 | Leroy Jean-Christophe 26 | norcal 27 | Marc Coll Carrillo 28 | Miguel Anxo Bouzada (mbouzada) 29 | Muhammad Radifar (radifar) 30 | Nicolas Delvaux 31 | SarahSlean (yoda4) 32 | Stefan Kardos 33 | t3ddy 34 | Ward Muylaert (wardje) 35 | Wendrock 36 | Willem Sonke 37 | Wolfs 38 | 39 | == Artwork == 40 | Dakal 41 | yeKcim 42 | 43 | == DejaVuSans.ttf == 44 | See: http://dejavu-fonts.org/wiki/License 45 | 46 | Thanks to all the people who helped create STKAddons :) 47 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | RUN export DEBIAN_FRONTEND=noninteractive && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime 4 | 5 | RUN apt update && \ 6 | apt -y install software-properties-common apt-utils curl gnupg cron git-core && \ 7 | add-apt-repository -y ppa:ondrej/php && \ 8 | add-apt-repository -y ppa:ondrej/apache2 9 | RUN apt update && apt -y install \ 10 | apache2 \ 11 | php7.2 \ 12 | mod-php7.2 \ 13 | php7.2-curl \ 14 | php7.2-mbstring \ 15 | php7.2-gd \ 16 | php7.2-gettext \ 17 | php7.2-pdo \ 18 | php7.2-pdo-mysql \ 19 | php7.2-simplexml \ 20 | php7.2-zip 21 | 22 | # install nodejs 23 | RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && 24 | RUN apt update && apt -y install nodejs 25 | 26 | # install yarn 27 | RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 28 | RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 29 | RUN apt update && apt -y install yarn 30 | 31 | 32 | # install composer 33 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer 34 | RUN composer global require "hirak/prestissimo:^0.3" --no-suggest --no-progress 35 | 36 | # install cron 37 | RUN \ 38 | # configure cron tasks 39 | echo '0 * * * * php /var/www/stk-addons/cron/hourly.php >/dev/null 2>&1' > /etc/cron.d/hourly && \ 40 | echo '0 2 * * * php /var/www/stk-addons/cron/daily.php >/dev/null 2>&1' > /etc/cron.d/daily && \ 41 | echo '0 2 */7 * * php /var/www/stk-addons/cron/weekly.php >/dev/null 2>&1' > /etc/cron.d/weekly 42 | 43 | # move configuration from install directory to specific directories 44 | COPY ./install/apache.EXAMPLE.conf /etc/apache2/sites-enabled/stk-addons.conf 45 | COPY ./install/htaccess.EXAMPLE /var/www/stk-addons/.htaccess 46 | COPY ./install/config.EXAMPLE.php /var/www/stk-addons/config.php 47 | 48 | RUN rm /etc/apache2/sites-enabled/000-default.conf 49 | RUN cp /etc/apache2/mods-available/rewrite.* /etc/apache2/mods-enabled/ 50 | 51 | # switch to document root 52 | WORKDIR /var/www/stk-addons 53 | 54 | # copy sources to document root 55 | COPY ./ ./ 56 | 57 | # owner of document root is apache user 58 | RUN chown -R www-data . 59 | 60 | # install composer packages 61 | RUN composer install --no-suggest --no-progress 62 | 63 | # install bower packages 64 | RUN yarn install --allow-root 65 | 66 | # remove unnecesary directories 67 | RUN rm -rf install 68 | RUN rm -rf packages.json yarn.lock .yarnrc .dockerignore .gitattributes .gitignore .travis.yml composer.* docker-compose.* Dockerfile* phpunit.xml 69 | 70 | EXPOSE 80 71 | 72 | CMD ["systemctl", "start", "cron"] 73 | CMD ["a2enmod", "rewrite"] 74 | CMD ["apachectl", "-DFOREGROUND"] 75 | -------------------------------------------------------------------------------- /Dockerfile-db-init: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update 3 | RUN apt-get install -y mariadb-client 4 | 5 | COPY ./docker-tools/ /docker-tools 6 | COPY ./install/install.sql /docker-tools/install.sql 7 | 8 | RUN chmod +x /docker-tools/wait-for-it.sh 9 | RUN chmod +x /docker-tools/init-db.sh 10 | -------------------------------------------------------------------------------- /about.php: -------------------------------------------------------------------------------- 1 | 4 | * 2011 - 2014 Stephen Just 5 | * 2014 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | 22 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 23 | 24 | $tpl = StkTemplate::get('about.tpl')->setMinify(false); 25 | $tpl->assignTitle(_h('About')); 26 | $tpl->assign('about', ['credits' => ['content' => FileSystem::fileGetContents("CREDITS")]]); 27 | 28 | echo $tpl; 29 | -------------------------------------------------------------------------------- /addons-menu.php: -------------------------------------------------------------------------------- 1 | 4 | * 2011-2014 Stephen Just 5 | * 2014-2015 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | try 24 | { 25 | $type = isset($_GET['type']) ? Addon::stringToType($_GET['type']) : null; 26 | $sort = isset($_GET['sort']) ? $_GET['sort'] : Addon::SORT_FEATURED; 27 | $order = isset($_GET['order']) ? $_GET['order'] : null; 28 | $addon_name = empty($_GET['name']) ? null : $_GET['name']; 29 | 30 | $current_page = PaginationTemplate::getPageNumber(); 31 | $limit = PaginationTemplate::getLimitNumber(); 32 | 33 | $addons = Addon::getAll($type, $limit, $current_page, $sort, $order); 34 | $template_addons = Addon::filterMenuTemplate($addons, $addon_name); 35 | 36 | $pagination = PaginationTemplate::get() 37 | ->setItemsPerPage($limit) 38 | ->setTotalItems(count(Addon::getAll($type))) 39 | ->setCurrentPage($current_page); 40 | 41 | $tpl = StkTemplate::get("addons/menu.tpl") 42 | ->assign("addons", $template_addons) 43 | ->assign("pagination", $pagination->toString()); 44 | 45 | echo $tpl; 46 | } 47 | catch (AddonException $e) 48 | { 49 | echo $e->getMessage(); 50 | } 51 | -------------------------------------------------------------------------------- /addons-panel.php: -------------------------------------------------------------------------------- 1 | 4 | * 2011-2014 Stephen Just 5 | * 2014-2016 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $id = isset($_GET['name']) ? $_GET['name'] : ""; 24 | $a_tpl = StkTemplate::get('addons/panel.tpl'); 25 | 26 | try 27 | { 28 | $viewer = new AddonViewer($id); 29 | $viewer->fillTemplate($a_tpl); 30 | echo $a_tpl; 31 | } 32 | catch(Exception $e) 33 | { 34 | echo $e->getMessage(); 35 | } 36 | -------------------------------------------------------------------------------- /addons.php: -------------------------------------------------------------------------------- 1 | 4 | * 2011-2014 Stephen Just 5 | * 2014-2015 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | // Validate addon-id parameter 24 | $_GET['type'] = (isset($_GET['type'])) ? $_GET['type'] : null; 25 | $_GET['name'] = (isset($_GET['name'])) ? Addon::cleanId($_GET['name']) : null; // name is actually the id 26 | $_GET['rev'] = (isset($_GET['rev'])) ? (int)$_GET['rev'] : null; 27 | $addon_exists = Addon::exists($_GET["name"]); 28 | $status = ""; 29 | 30 | // addon type is optional 31 | if (!$_GET['type']) 32 | { 33 | $_GET['type'] = Addon::getTypeByID($_GET['name']); 34 | } 35 | 36 | // check type 37 | switch (Addon::stringToType($_GET['type'])) 38 | { 39 | case Addon::TRACK: 40 | $type_label = _h('Tracks'); 41 | break; 42 | 43 | case Addon::KART: 44 | $type_label = _h('Karts'); 45 | break; 46 | 47 | case Addon::ARENA: 48 | $type_label = _h('Arenas'); 49 | break; 50 | 51 | default: 52 | exit(_h('Invalid addon type.')); // TODO redirect with error 53 | break; 54 | } 55 | 56 | // build title 57 | $title = $type_label . ' - ' . _h('SuperTuxKart Add-ons'); 58 | if ($addon_exists) 59 | { 60 | $addonName = Addon::getNameByID($_GET['name']); 61 | if ($addonName) 62 | { 63 | $title = $addonName . ' - ' . $title; 64 | } 65 | } 66 | 67 | // build template 68 | $tpl = StkTemplate::get("addons/index.tpl") 69 | ->assign("title", $title) 70 | ->assign("is_name", $_GET['name']) 71 | ->addUtilLibrary() 72 | ->addBootstrapMultiSelectLibrary() 73 | ->addScriptInclude("addon.js"); 74 | $tpl_data = [ 75 | 'menu' => Util::ob_get_require_once(ROOT_PATH . "addons-menu.php"), 76 | 'body' => '', 77 | 'type' => $_GET['type'], 78 | 'status' => $status 79 | ]; 80 | 81 | // right panel 82 | if ($addon_exists) 83 | { 84 | $tpl_data['body'] = Util::ob_get_require_once(ROOT_PATH . 'addons-panel.php'); 85 | } 86 | 87 | // output the view 88 | $tpl->assign('addon', $tpl_data); 89 | echo $tpl; 90 | -------------------------------------------------------------------------------- /api/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteCond %{REQUEST_FILENAME} !-f 3 | RewriteRule . index.php [QSA,L] 4 | -------------------------------------------------------------------------------- /api/index.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | define('API_MODE', true); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $klein = new \Klein\Klein(); 24 | $klein->with( 25 | API_LOCATION . '/' . API_VERSION, 26 | function () use ($klein) 27 | { 28 | // user 29 | $klein->respond( 30 | ['GET', 'POST'], 31 | '/user/[:action]/?', 32 | function ($request, $response) 33 | { 34 | $_POST["action"] = $request->action; 35 | 36 | return Util::ob_get_require_once("user.php"); 37 | } 38 | ); 39 | 40 | // server 41 | $klein->respond( 42 | ['GET', 'POST'], 43 | '/server/[:action]/?', 44 | function ($request, $response) 45 | { 46 | $_POST["action"] = $request->action; 47 | 48 | return Util::ob_get_require_once("server.php"); 49 | } 50 | ); 51 | } 52 | ); 53 | $klein->dispatch(); 54 | -------------------------------------------------------------------------------- /assets/.htaccess: -------------------------------------------------------------------------------- 1 | Options -Indexes 2 | -------------------------------------------------------------------------------- /assets/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /assets/dtd/news.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /assets/fonts/DejaVuSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/fonts/DejaVuSans.ttf -------------------------------------------------------------------------------- /assets/fonts/OpenSans.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/fonts/OpenSans.woff -------------------------------------------------------------------------------- /assets/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/background.jpg -------------------------------------------------------------------------------- /assets/img/emblem-favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/emblem-favorite.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-114.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-120.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-144.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-150.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-152.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-16.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-160.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-160.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-180.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-192.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-310.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-32.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-57.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-60.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-64.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-70.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-72.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-76.png -------------------------------------------------------------------------------- /assets/img/favicon/favicon-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/favicon/favicon-96.png -------------------------------------------------------------------------------- /assets/img/flags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/flags.png -------------------------------------------------------------------------------- /assets/img/home-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/home-icons.png -------------------------------------------------------------------------------- /assets/img/home-icons.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/home-icons.xcf -------------------------------------------------------------------------------- /assets/img/index-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/index-icons.png -------------------------------------------------------------------------------- /assets/img/kart-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/kart-icon.png -------------------------------------------------------------------------------- /assets/img/karts-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/karts-small.png -------------------------------------------------------------------------------- /assets/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/loader.gif -------------------------------------------------------------------------------- /assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/logo.png -------------------------------------------------------------------------------- /assets/img/logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/logo_large.png -------------------------------------------------------------------------------- /assets/img/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/logo_small.png -------------------------------------------------------------------------------- /assets/img/news-panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/news-panel.png -------------------------------------------------------------------------------- /assets/img/notfound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/notfound.png -------------------------------------------------------------------------------- /assets/img/sad-tux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/sad-tux.png -------------------------------------------------------------------------------- /assets/img/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/stars.png -------------------------------------------------------------------------------- /assets/img/track-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/track-icon.png -------------------------------------------------------------------------------- /assets/img/tracks-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/tracks-small.png -------------------------------------------------------------------------------- /assets/img/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/assets/img/user.png -------------------------------------------------------------------------------- /assets/js/jquery.newsticker.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk) 4 | * Licensed under the MIT License: 5 | * http://www.opensource.org/licenses/mit-license.php 6 | * 7 | * Version 2.0 8 | * Demo: http://www.texotela.co.uk/code/jquery/newsticker/ 9 | * 10 | * $LastChangedDate: 2007-05-29 11:31:36 +0100 (Tue, 29 May 2007) $ 11 | * $Rev: 2005 $ 12 | * 13 | */ 14 | 15 | (function($) { 16 | /* 17 | * A basic news ticker. 18 | * 19 | * @name newsticker (or newsTicker) 20 | * @param delay Delay (in milliseconds) between iterations. Default 4 seconds (4000ms) 21 | * @author Sam Collett (http://www.texotela.co.uk) 22 | * @example $("#news").newsticker(); // or $("#news").newsTicker(5000); 23 | * 24 | */ 25 | $.fn.newsTicker = $.fn.newsticker = function(delay) 26 | { 27 | delay = delay || 4000; 28 | initTicker = function(el) 29 | { 30 | stopTicker(el); 31 | el.items = $("li", el); 32 | // hide all items (except first one) 33 | el.items.not(":eq(0)").hide().end(); 34 | // current item 35 | el.currentitem = 0; 36 | startTicker(el); 37 | }; 38 | startTicker = function(el) 39 | { 40 | el.tickfn = setInterval(function() { doTick(el) }, delay) 41 | }; 42 | stopTicker = function(el) 43 | { 44 | clearInterval(el.tickfn); 45 | }; 46 | pauseTicker = function(el) 47 | { 48 | el.pause = true; 49 | }; 50 | resumeTicker = function(el) 51 | { 52 | el.pause = false; 53 | }; 54 | doTick = function(el) 55 | { 56 | // don't run if paused 57 | if(el.pause) return; 58 | // pause until animation has finished 59 | el.pause = true; 60 | // hide current item 61 | $(el.items[el.currentitem]).fadeOut("slow", 62 | function() 63 | { 64 | $(this).hide(); 65 | // move to next item and show 66 | el.currentitem = ++el.currentitem % (el.items.size()); 67 | $(el.items[el.currentitem]).fadeIn("slow", 68 | function() 69 | { 70 | el.pause = false; 71 | } 72 | ); 73 | } 74 | ); 75 | }; 76 | this.each( 77 | function() 78 | { 79 | if(this.nodeName.toLowerCase()!= "ul") return; 80 | initTicker(this); 81 | } 82 | ) 83 | .addClass("newsticker") 84 | .hover( 85 | function() 86 | { 87 | // pause if hovered over 88 | pauseTicker(this); 89 | }, 90 | function() 91 | { 92 | // resume when not hovered over 93 | resumeTicker(this); 94 | } 95 | ); 96 | return this; 97 | }; 98 | 99 | })(jQuery); -------------------------------------------------------------------------------- /assets/js/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * copyright 2013 Stephen Just 3 | * 2014 Daniel Butum 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | $(document).ready(function() { 22 | "use strict"; 23 | 24 | /** 25 | * Tests if there is SVG support. Maybe move it to util.js if we need it? 26 | * 27 | * @return {bool} 28 | */ 29 | function isSVGSupported() { 30 | return !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect; 31 | } 32 | 33 | // mark link as active in the top nav 34 | var page_parts = window.location.href.split("?"), 35 | current_page = page_parts[0], 36 | current_query = page_parts[1], 37 | $link = $(".navbar-nav a[href^='" + current_page + "']"), 38 | $closest_ul = $link.first().closest("ul"), 39 | has_dropdown = $closest_ul.hasClass("dropdown-menu"); 40 | 41 | if ($link.length === 1 && !has_dropdown) { // top link 42 | $link.parent().addClass("active"); 43 | } else { // multiple top links 44 | 45 | if (has_dropdown) { // dropdown 46 | $closest_ul.parent().addClass("active"); 47 | 48 | $link.each(function() { // mark in dropdown 49 | if (current_query === this.href.split("?")[1]) { 50 | $(this).parent().addClass("active"); 51 | } 52 | }); 53 | } else { // normal link, select first 54 | $link.first().parent().addClass("active"); 55 | } 56 | } 57 | 58 | // language menu 59 | $('#lang-menu > a').click(function() { 60 | $('ul.menu-body').slideToggle('fast'); // language menu 61 | }); 62 | 63 | // auto validation 64 | if ($.fn.bootstrapValidator) { 65 | $('.auto-validation').bootstrapValidator(); 66 | } 67 | 68 | // svg with png fallback 69 | if (!isSVGSupported()) { 70 | $('img[src*="svg"]').attr('src', function() { 71 | return $(this).attr('src').replace('.svg', '.png'); 72 | }); 73 | } 74 | }); 75 | -------------------------------------------------------------------------------- /assets/js/upload.js: -------------------------------------------------------------------------------- 1 | /** 2 | * copyright 2014 Daniel Butum 3 | * 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | (function($) { 21 | "use strict"; 22 | 23 | $("#file_addon").fileinput({showUpload: false}); 24 | 25 | var $radio_author1 = $("#l_author1"), 26 | $radio_author2 = $("#l_author2"), 27 | $checkbox_license1 = $("#l_licensefile1"), 28 | $checkbox_license2 = $("#l_licensefile2"), 29 | $label_license1 = $("#l_licensetext1"), 30 | $label_license2 = $("#l_licensetext2"), 31 | $select_file_type = $("#upload-type"); 32 | 33 | function agreementToggle() { 34 | if ($radio_author1.prop("checked")) { 35 | $checkbox_license1.attr("disabled", false); 36 | $checkbox_license2.attr("disabled", true); 37 | $label_license1.css("color", '#000000'); 38 | $label_license2.css("color", '#999999'); 39 | } else { 40 | $checkbox_license1.attr("disabled", true); 41 | $checkbox_license2.attr("disabled", false); 42 | $label_license1.css("color", '#999999'); 43 | $label_license2.css("color", '#000000'); 44 | } 45 | } 46 | 47 | function uploadFormFieldToggle() { 48 | agreementToggle(); 49 | 50 | if ($select_file_type) { 51 | if ($select_file_type.val() == "1") { 52 | $checkbox_license1.attr("disabled", true); 53 | $checkbox_license2.attr("disabled", true); 54 | $label_license1.css("color", '#999999'); 55 | $label_license2.css("color", '#999999'); 56 | } else { 57 | agreementToggle(); 58 | } 59 | } 60 | } 61 | 62 | $radio_author1.change(function() { 63 | uploadFormFieldToggle(); 64 | }); 65 | 66 | $radio_author2.change(function() { 67 | uploadFormFieldToggle(); 68 | }); 69 | 70 | $select_file_type.change(function() { 71 | uploadFormFieldToggle(); 72 | }); 73 | 74 | uploadFormFieldToggle(); 75 | 76 | })(jQuery); 77 | -------------------------------------------------------------------------------- /assets/libs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /bugs/add.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $tpl = StkTemplate::get("bugs/add.tpl") 23 | ->assign("current_url", URL::encode(URL::getCurrent(false, false))); 24 | 25 | // check permission 26 | if (!User::hasPermission(AccessControl::PERM_ADD_BUG)) 27 | { 28 | $tpl->assign("bug", []); 29 | exit($tpl); 30 | } 31 | 32 | $tpl->assign( 33 | "bug", 34 | [ 35 | "title" => ["min" => Bug::MIN_TITLE, "max" => Bug::MAX_TITLE], 36 | "description" => ["min" => Bug::MIN_DESCRIPTION, "max" => Bug::MAX_DESCRIPTION], 37 | "close_reason" => ["min" => Bug::MIN_CLOSE_REASON, "max" => Bug::MAX_CLOSE_REASON] 38 | ] 39 | ); 40 | echo $tpl; 41 | -------------------------------------------------------------------------------- /bugs/all.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $tpl = StkTemplate::get('bugs/all.tpl'); 23 | 24 | $tpl_data = ["items" => Bug::getAll()]; 25 | 26 | $tpl->assign("bugs", $tpl_data); 27 | echo $tpl; 28 | -------------------------------------------------------------------------------- /bugs/index.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $tpl = StkTemplate::get('bugs/index.tpl') 23 | ->addDataTablesLibrary() 24 | ->addWYSIWYGLibrary() 25 | ->addTypeHeadLibrary() 26 | ->addBootstrapValidatorLibrary() 27 | ->addUtilLibrary() 28 | ->addScriptInclude("bugs.js"); 29 | $tpl_data = ["show_btn_file" => true]; 30 | 31 | if (isset($_GET["bug_id"])) 32 | { 33 | $tpl->assignTitle(_h("View Bug")); 34 | $tpl_data["show_btn_file"] = false; 35 | $tpl_data["content"] = Util::ob_get_require_once(BUGS_PATH . "view.php"); 36 | } 37 | elseif (isset($_GET["add"])) 38 | { 39 | $tpl->assignTitle(_h("Add Bug")); 40 | $tpl_data["show_btn_file"] = false; 41 | $tpl_data["content"] = Util::ob_get_require_once(BUGS_PATH . "add.php"); 42 | } 43 | else 44 | { 45 | $tpl->assignTitle(_h("All bugs")); 46 | $tpl_data["content"] = Util::ob_get_require_once(BUGS_PATH . "all.php"); 47 | } 48 | 49 | $tpl->assign("bugs", $tpl_data); 50 | echo $tpl; 51 | -------------------------------------------------------------------------------- /bugs/view.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $bug_id = isset($_GET["bug_id"]) ? (int)$_GET["bug_id"] : 0; 23 | $bug = null; 24 | 25 | if (!$bug_id) 26 | { 27 | Util::redirectError(404); 28 | } 29 | try 30 | { 31 | $bug = Bug::get($bug_id); 32 | } 33 | catch(BugException $e) 34 | { 35 | Util::redirectError(404); 36 | } 37 | 38 | $tpl = StkTemplate::get("bugs/view.tpl"); 39 | 40 | // clean comments 41 | $comments_data = $bug->getCommentsData(); 42 | Util::htmlPurifyApply($comments_data, "description"); 43 | 44 | $tpl_data = [ 45 | "id" => $bug->getId(), 46 | "title" => h($bug->getTitle()), 47 | "user_id" => $bug->getUserId(), 48 | "user_name" => h($bug->getUserName()), 49 | "addon" => $bug->getAddonId(), 50 | "date_report" => $bug->getDateReport(), 51 | "date_edit" => $bug->getDateEdit(), 52 | 53 | // close data 54 | "close_reason" => Util::htmlPurify($bug->getCloseReason()), 55 | "close_name" => h($bug->getCloseUserName()), 56 | "date_close" => $bug->getDateClose(), 57 | "close_id" => $bug->getCloseId(), 58 | "is_closed" => $bug->isClosed(), 59 | 60 | "description" => Util::htmlPurify($bug->getDescription()), 61 | "comments" => $comments_data 62 | ]; 63 | 64 | $can_edit = User::hasPermission(AccessControl::PERM_EDIT_BUGS); 65 | $tpl->assign("bug", $tpl_data) 66 | ->assign("current_url", URL::encode(URL::getCurrent(false, false))) 67 | ->assign("can_add_comment", User::hasPermission(AccessControl::PERM_ADD_BUG_COMMENT)) 68 | ->assign("can_edit_bug", (User::getLoggedId() === $tpl_data["id"]) || $can_edit) 69 | ->assign("can_delete_bug", $can_edit) 70 | ->assign("can_edit_comment", $can_edit); 71 | 72 | echo $tpl; 73 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "license" : "GPL-3.0", 3 | "require": { 4 | "smarty/smarty": "~3.1", 5 | "smarty-gettext/smarty-gettext": "~1.4", 6 | "ezyang/htmlpurifier": "~4.8", 7 | "google/recaptcha": "~1.1", 8 | "klein/klein": "~2.1", 9 | "vlucas/valitron": "~1.2", 10 | "phpmailer/phpmailer": "^6.5", 11 | "pear/archive_tar": "~1.3", 12 | "filp/whoops": "^2.1", 13 | "php" : ">=7.2", 14 | "ext-gd": "*", 15 | "ext-zip": "*", 16 | "ext-pdo": "*", 17 | "ext-gettext": "*", 18 | "ext-mbstring": "*", 19 | "ext-simplexml": "*", 20 | "ext-json": "*", 21 | "ext-xml": "*", 22 | "myclabs/php-enum": "^1.5", 23 | "webmozart/assert": "^1.2", 24 | "nategood/commando": "*" 25 | }, 26 | "require-dev": { 27 | "phpunit/phpunit": "^7", 28 | "phpmd/phpmd" : "@stable", 29 | "maximebf/debugbar": "1.*", 30 | "phpstan/phpstan": "^0.11", 31 | "phpstan/phpstan-phpunit": "^0.11", 32 | "phpstan/phpstan-strict-rules": "^0.11", 33 | "phpstan/phpstan-webmozart-assert": "^0.11", 34 | "squizlabs/php_codesniffer": "~3.0" 35 | }, 36 | "autoload": { 37 | "classmap": [ 38 | "include/", 39 | "cron/src" 40 | ], 41 | "files": ["include/functions.php", "include/xmlWrite.php"] 42 | }, 43 | "scripts": { 44 | "phpcs": "phpcs -s --standard=phpcs/ruleset.xml --ignore=vendor/ --extensions=php .", 45 | "phpstan": "phpstan analyse -c phpstan/config.phpstan.neon ." 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /cron/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all 2 | -------------------------------------------------------------------------------- /cron/daily.php: -------------------------------------------------------------------------------- 1 | 4 | * 2015 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | define('CRON_MODE', true); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | echo "Executed at: " . date('d/m/Y H:i:s', time()) . "\n"; 24 | 25 | DailyCron::run(); 26 | -------------------------------------------------------------------------------- /cron/hourly.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | define('CRON_MODE', true); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | echo "Executed at: " . date('d/m/Y H:i:s', time()) . "\n"; 24 | 25 | HourlyCron::run(); 26 | -------------------------------------------------------------------------------- /cron/src/DailyCron.php: -------------------------------------------------------------------------------- 1 | getMessage(); 16 | } 17 | 18 | try 19 | { 20 | Verification::cron(CRON_DAILY_VERIFICATION_DAYS); 21 | echo "SUCCESS: Verification::cron \n"; 22 | } 23 | catch (VerificationException $e) 24 | { 25 | echo "ERROR: Verification::cron \n" . $e->getMessage(); 26 | } 27 | 28 | try 29 | { 30 | Ranking::cron(); 31 | echo "SUCCESS: Ranking::cron \n"; 32 | } 33 | catch (RankingException $e) 34 | { 35 | echo "ERROR: RankingException::cron \n" . $e->getMessage(); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /cron/src/HourlyCron.php: -------------------------------------------------------------------------------- 1 | getMessage(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cron/src/WeeklyCron.php: -------------------------------------------------------------------------------- 1 | DateUserDescription'; 17 | foreach ($events as $event) 18 | { 19 | $table .= '' . $event['date'] . '' . strip_tags($event['name']) . '' . strip_tags( 20 | $event['message'] 21 | ) . ''; 22 | } 23 | $table .= ''; 24 | 25 | $content = 'The following events have occurred in the last 7 days:
' . $table; 26 | 27 | try 28 | { 29 | StkMail::get()->moderatorNotification('Weekly log update', $content); 30 | } 31 | catch (StkMailException $e) 32 | { 33 | StkLog::newEvent($e->getMessage(), LogLevel::ERROR); 34 | exit; 35 | } 36 | 37 | StkLog::setAllEventsMailed(); 38 | 39 | echo "Sent log message email.\n"; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cron/weekly.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | define('CRON_MODE', true); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | echo "Executed at: " . date('d/m/Y H:i:s', time()) . "\n"; 24 | 25 | WeeklyCron::run(); 26 | -------------------------------------------------------------------------------- /dl/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !xml 4 | !images -------------------------------------------------------------------------------- /dl/images/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /dl/xml/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /docker-compose.dev.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | # Mount stk-addons so that we don't need to restart anymore? 4 | services: 5 | www: 6 | volumes: 7 | - ./:/var/www/stk-addons 8 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | www: 5 | build: . 6 | ports: 7 | - 4680:80 8 | 9 | database: 10 | image: mariadb 11 | environment: 12 | - MYSQL_ROOT_PASSWORD=root-secret-pw 13 | - MYSQL_DATABASE=stk_addons 14 | - MYSQL_HOST=database 15 | volumes: 16 | - db-data:/var/lib/mysql 17 | 18 | adminer: 19 | environment: 20 | - ADMINER_DESIGN=nette 21 | image: adminer 22 | ports: 23 | - "4681:8080" 24 | 25 | db-init: 26 | build: 27 | dockerfile: Dockerfile-db-init 28 | context: . 29 | environment: 30 | - MYSQL_ROOT_PASSWORD=root-secret-pw 31 | - MYSQL_USER=stk_addons 32 | - MYSQL_USER_PASSWORD=your super secret password 33 | - MYSQL_DATABASE=stk_addons 34 | - MYSQL_HOST=database 35 | command: [ 36 | "/docker-tools/wait-for-it.sh", "database:3306", "-t", "60", 37 | "--", 38 | "/docker-tools/init-db.sh" 39 | ] 40 | depends_on: 41 | - database 42 | 43 | volumes: 44 | db-data: 45 | -------------------------------------------------------------------------------- /docker-tools/init-db.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | if [[ $(mysqlshow -h "$MYSQL_HOST" -u root -p$MYSQL_ROOT_PASSWORD "$MYSQL_DATABASE" | grep "v3_") ]]; then 5 | echo "Database already initialized, skipping." 6 | exit 0 7 | fi 8 | 9 | echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_USER_PASSWORD'" | mysql -h "$MYSQL_HOST" -u root -p$MYSQL_ROOT_PASSWORD 10 | echo "GRANT ALL PRIVILEGES ON stk_addons.* TO 'stk_addons'@'%'" | mysql -h "$MYSQL_HOST" -u root -p$MYSQL_ROOT_PASSWORD 11 | 12 | mysql -h "$MYSQL_HOST" -u root -p$MYSQL_ROOT_PASSWORD "$MYSQL_DATABASE" < /docker-tools/install.sql 13 | -------------------------------------------------------------------------------- /download.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | define('DOWNLOAD_MODE', true); 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $file = isset($_GET['file']) ? $_GET['file'] : null; 24 | 25 | $assets_path = filter_var($file, FILTER_SANITIZE_URL); 26 | 27 | // TODO probably the best solutions is not to redirect to the file, but instead output the file from here 28 | // Don't bother checking if the file exists - if it doesn't exist, you'll get 29 | // a 404 error anyways after redirecting. Yes, this may make the stats below 30 | // inaccurate, but the actual 404's that used to be thrown here were relatively 31 | // rare anyways. 32 | 33 | // Check user-agent 34 | $user_agent = $_SERVER['HTTP_USER_AGENT']; 35 | $matches = []; 36 | $uri = $_SERVER['REQUEST_URI']; 37 | if (Util::str_contains($uri, 'news.xml') && 38 | preg_match('#^(SuperTuxKart/[a-z0-9\\.\\-_]+)( \\(.*\\))?$#', $user_agent, $matches)) 39 | { 40 | try 41 | { 42 | DBConnection::get()->query( 43 | 'INSERT IGNORE INTO `{DB_VERSION}_clients` 44 | (`agent_string`) 45 | VALUES 46 | (:uagent)', 47 | DBConnection::NOTHING, 48 | [':uagent' => $matches[1]] 49 | ); 50 | } 51 | catch(DBException $e) 52 | { 53 | http_response_code(404); 54 | exit; 55 | } 56 | 57 | // Increase daily count for this user-agent 58 | try 59 | { 60 | DBConnection::get()->query( 61 | 'INSERT INTO `{DB_VERSION}_stats` 62 | (`type`,`date`,`value`) 63 | VALUES 64 | (:type, CURDATE(), 1) 65 | ON DUPLICATE KEY UPDATE 66 | `value` = `value` + 1', 67 | DBConnection::NOTHING, 68 | [':type' => 'uagent ' . $user_agent] 69 | ); 70 | } 71 | catch(DBException $e) 72 | { 73 | http_response_code(404); 74 | exit('Failed to update statistics'); 75 | } 76 | } 77 | 78 | // Update download count for addons 79 | try 80 | { 81 | File::incrementDownload($assets_path); 82 | } 83 | catch(FileException $e) 84 | { 85 | http_response_code(404); 86 | exit; 87 | } 88 | 89 | // Redirect to actual resource, 90 | header('Location: ' . ROOT_LOCATION . 'downloads/' . $assets_path); 91 | exit; 92 | -------------------------------------------------------------------------------- /downloads: -------------------------------------------------------------------------------- 1 | dl/ -------------------------------------------------------------------------------- /error.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $error = [ 23 | "code" => (empty($_GET['e'])) ? null : (int)$_GET['e'], 24 | "title" => "", 25 | "message" => "" 26 | ]; 27 | $tpl = StkTemplate::get('error-page.tpl'); 28 | 29 | // Send appropriate error header 30 | switch ($error["code"]) 31 | { 32 | case 401: 33 | header('HTTP/1.0 401 Unauthorized'); 34 | $error["title"] = _h("401 Unauthorized"); 35 | $error["message"] = _h("You do not have permission to access this page."); 36 | break; 37 | 38 | case 403: 39 | header('HTTP/1.1 403 Forbidden'); 40 | $error["title"] = _h("403 - Forbidden"); 41 | $error["message"] = _h("You're not supposed to be here. Click one of the links in the menu above to find some better content."); 42 | break; 43 | 44 | case 404: 45 | header('HTTP/1.1 404 Not Found'); 46 | $error["title"] = _h("404 - Not Found"); 47 | $error["message"] = _h("We can't find what you are looking for. The link you followed may be broken."); 48 | break; 49 | 50 | default: 51 | $error["title"] = _h("An Error Occurred"); 52 | $error["message"] = _h("Something broke! We'll try to fix it as soon as we can!"); 53 | break; 54 | } 55 | 56 | $tpl->assign("error", $error); 57 | echo $tpl; 58 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/favicon.ico -------------------------------------------------------------------------------- /image.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $size = empty($_GET['size']) ? null : $_GET['size']; 23 | $file = empty($_GET['pic']) ? null : $_GET['pic']; 24 | StkImage::resizeImage($file, (int)$size); 25 | -------------------------------------------------------------------------------- /include/Aliases.class.php: -------------------------------------------------------------------------------- 1 | . 19 | */ 20 | 21 | // Define all Used aliases 22 | class Assert extends \Webmozart\Assert\Assert {} 23 | class LogLevel extends Psr\Log\LogLevel {} 24 | -------------------------------------------------------------------------------- /include/IAsXML.php: -------------------------------------------------------------------------------- 1 | 4 | * 2013 Glenn De Jonghe 5 | * 2014-2015 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | 22 | /** 23 | * Class to contain all common validation functions, the user validation functions are in the User class 24 | */ 25 | class Validate 26 | { 27 | /** 28 | * @param string $box 29 | * @param string $message 30 | * 31 | * @return mixed 32 | * @throws ValidateException 33 | */ 34 | public static function checkbox($box, $message) 35 | { 36 | if ($box !== 'on') 37 | { 38 | throw new ValidateException($message); 39 | } 40 | 41 | return $box; 42 | } 43 | 44 | /** 45 | * Validate the version string 46 | * 47 | * @param string $string 48 | * 49 | * @throws ValidateException 50 | */ 51 | public static function versionString($string) 52 | { 53 | if (!preg_match('/^(svn|[\d]+\.[\d]+\.[\d](-rc[\d])?)$/i', $string)) 54 | { 55 | throw new ValidateException(_h('Invalid version string! Format should be: W.X.Y[-rcZ]')); 56 | } 57 | } 58 | 59 | /** 60 | * Validator singleton 61 | * 62 | * @param array $data 63 | * 64 | * @link https://github.com/vlucas/valitron 65 | * @return \Valitron\Validator 66 | */ 67 | public static function get($data) 68 | { 69 | return new Valitron\Validator($data); 70 | } 71 | 72 | /** 73 | * Check if an array has the keys in $params and must be not empty 74 | * 75 | * @param array $pool the array to check 76 | * @param array $params the keys to check 77 | * 78 | * @return array the error array 79 | */ 80 | public static function ensureNotEmpty(array $pool, array $params) 81 | { 82 | $errors = []; 83 | 84 | foreach ($params as $param) 85 | { 86 | if (empty($pool[$param])) 87 | { 88 | $errors[] = sprintf(_h("%s field is empty"), ucfirst($param)); 89 | } 90 | } 91 | 92 | return $errors; 93 | } 94 | 95 | /** 96 | * Check if an array has the keys in $params 97 | * 98 | * @param array $pool the array to check 99 | * @param array $params the keys to check 100 | * 101 | * @return array the error array 102 | */ 103 | public static function ensureIsSet(array $pool, array $params) 104 | { 105 | $errors = []; 106 | 107 | foreach ($params as $param) 108 | { 109 | if (!isset($pool[$param])) 110 | { 111 | $errors[] = sprintf(_h("%s field is not set"), ucfirst($param)); 112 | } 113 | } 114 | 115 | return $errors; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /include/XMLOutput.class.php: -------------------------------------------------------------------------------- 1 | 6 | * This file is part of SuperTuxKart 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | 22 | /** 23 | * XMLOutput class, handles all the XML writing behaviour for the API 24 | */ 25 | class XMLOutput extends XMLWriter 26 | { 27 | /** 28 | * The constructor 29 | */ 30 | public function __construct() 31 | { 32 | $this->openMemory(); 33 | $this->setIndent(false); 34 | } 35 | 36 | /** 37 | * Insert XML as a string. 38 | * 39 | * @param string $xml_string the xml string to write 40 | * 41 | * @return bool 42 | */ 43 | public function insert($xml_string) 44 | { 45 | return $this->writeRaw($xml_string); 46 | } 47 | 48 | /** 49 | * Will flush all output and output as XML. 50 | */ 51 | public function printToScreen() 52 | { 53 | ob_start(); 54 | header('Content-type: text/xml'); 55 | echo $this->outputMemory(); 56 | ob_end_flush(); 57 | } 58 | 59 | /** 60 | * Can be used for debugging purposes. Flushed the memory. 61 | */ 62 | public function printAsString() 63 | { 64 | echo $this->outputMemory(); 65 | } 66 | 67 | /** 68 | * Helper method. Add an error element that is sent to the server, with attribute success no 69 | * 70 | * @param string $element_name 71 | * @param string $info 72 | */ 73 | public function addErrorElement($element_name, $info) 74 | { 75 | // handle MAINTENANCE_MODE 76 | $attr_info = function_exists("h") ? h($info) : $info; 77 | 78 | $this->startElement($element_name); 79 | $this->writeAttribute('success', 'no'); 80 | $this->writeAttribute('info', $attr_info); 81 | $this->endElement(); 82 | } 83 | 84 | /** 85 | * Can be used for debugging purposes or to pass between methods. Flushes the memory. 86 | */ 87 | public function asString() 88 | { 89 | return $this->outputMemory(); 90 | } 91 | 92 | /** 93 | * Helper function that exits with an xml error. 94 | * 95 | * @param string $message 96 | */ 97 | public static function exitXML($message) 98 | { 99 | $output = new XMLOutput(); 100 | $output->startDocument('1.0', 'UTF-8'); 101 | 102 | $output->addErrorElement("request", $message); 103 | $output->endDocument(); 104 | 105 | $output->printToScreen(); 106 | exit(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /include/functions.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014-2015 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | /** 22 | * Macro function for htmlspecialchars(_($message)) with additional options 23 | * 24 | * @param string $message 25 | * 26 | * @return string 27 | */ 28 | function _h($message) 29 | { 30 | return h(_($message)); 31 | } 32 | 33 | /** 34 | * Macro function for htmlspecialchars() with additional options 35 | * 36 | * @param string $message 37 | * 38 | * @return string 39 | */ 40 | function h($message) 41 | { 42 | return htmlspecialchars($message, ENT_QUOTES | ENT_HTML5, "UTF-8", false); 43 | } 44 | 45 | /** 46 | * Macro function that calls exit and json_encode 47 | * 48 | * @param string $message 49 | * @param array $other_values other options to send back 50 | */ 51 | function exit_json_error($message, array $other_values = []) 52 | { 53 | exit(json_encode(["error" => $message] + $other_values)); 54 | } 55 | 56 | /** 57 | * Macro function that calls exit and json_encode 58 | * 59 | * @param string $message 60 | * @param array $other_values other options to send back 61 | */ 62 | function exit_json_success($message, array $other_values = []) 63 | { 64 | exit(json_encode(["success" => $message] + $other_values)); 65 | } 66 | 67 | /** 68 | * Get the default exception message when something is wrong with the database 69 | * 70 | * @param string $message 71 | * 72 | * @return string 73 | */ 74 | function exception_message_db($message) 75 | { 76 | return h( 77 | sprintf(_('A database error occurred while trying to %s.'), $message) . ' ' . 78 | _('Please contact a website administrator.') 79 | ); 80 | } 81 | 82 | /** 83 | * Minify html 84 | * 85 | * @param string $tpl_output the html to minify 86 | * @param Smarty_Internal_Template $template 87 | * 88 | * @return string 89 | */ 90 | function minify_html($tpl_output, Smarty_Internal_Template $template) 91 | { 92 | return preg_replace(['/\>[^\S ]+/s', '/[^\S ]+\', '<', '\\1'], $tpl_output); 93 | } 94 | -------------------------------------------------------------------------------- /include/parsers/Parser.class.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | /** 22 | * Class Parser 23 | */ 24 | abstract class Parser 25 | { 26 | /** 27 | * @var bool 28 | */ 29 | protected $binary_file = false; 30 | 31 | /** 32 | * The file resource 33 | * @var resource|null 34 | */ 35 | protected $file; 36 | 37 | /** 38 | * @var string 39 | */ 40 | protected $file_name; 41 | 42 | /** 43 | * @var int 44 | */ 45 | protected $file_size = 0; 46 | 47 | /** 48 | * Flag that indicates to open the file with write access 49 | * @var bool 50 | */ 51 | protected $writeable = false; 52 | 53 | /** 54 | * Load a file into the parser 55 | * 56 | * @param string $file File, absolute path 57 | * @param boolean $write Open with write access 58 | * @param boolean $binary Open in binary mode 59 | * 60 | * @throws ParserException 61 | */ 62 | public function loadFile($file, $write = false, $binary = null) 63 | { 64 | if ($binary === null) 65 | { 66 | $binary = $this->binary_file; 67 | } 68 | if (!FileSystem::exists($file)) 69 | { 70 | throw new ParserException('File not found'); 71 | } 72 | 73 | $read_flag = ($write) ? 'r+' : 'r'; 74 | if ($binary) 75 | { 76 | $read_flag .= 'b'; 77 | } 78 | 79 | try 80 | { 81 | $handle = FileSystem::fileOpen($file, $read_flag); 82 | } 83 | catch (FileSystemException $e) 84 | { 85 | if (DEBUG_MODE) 86 | throw new ParserException($e->getMessage()); 87 | else 88 | throw new ParserException('Error opening file = ' . $file); 89 | } 90 | 91 | $this->file_name = basename($file); 92 | $this->file = $handle; 93 | 94 | try 95 | { 96 | $this->file_size = FileSystem::fileSize($file); 97 | } 98 | catch (FileSystemException $e) 99 | { 100 | throw new ParserException($e); 101 | } 102 | 103 | $this->writeable = $write; 104 | $this->_loadFile(); 105 | } 106 | 107 | /** 108 | * Custom load file 109 | */ 110 | abstract protected function _loadFile(); 111 | } 112 | -------------------------------------------------------------------------------- /include/parsers/SPMParser.class.php: -------------------------------------------------------------------------------- 1 | . 19 | */ 20 | 21 | /** 22 | * Helper class to parse SPM model files 23 | */ 24 | class SPMParser extends Parser 25 | { 26 | /** 27 | * @var bool 28 | */ 29 | protected $binary_file = true; 30 | 31 | /** 32 | * @var int 33 | */ 34 | private $material_count = 0; 35 | 36 | /** 37 | * @throws SPMException 38 | */ 39 | protected function _loadFile() 40 | { 41 | // See https://github.com/supertuxkart/stk-code/blob/master/src/graphics/sp_mesh_loader.cpp 42 | // for reference 43 | 44 | // Read the file header 45 | fseek($this->file, 0); 46 | $read = fread($this->file, 2); 47 | if ($read !== 'SP') 48 | { 49 | throw new SPMException('Invalid header on SPM file'); 50 | } 51 | 52 | // Skip misc header (like bounding box) 53 | fseek($this->file, 28); 54 | $read = fread($this->file, 2); 55 | $byte = unpack('v', $read); 56 | $this->material_count = $byte[1]; 57 | } 58 | 59 | /** 60 | * Get the textures referenced by the model 61 | * 62 | * @return array 63 | * @throws SPMException 64 | */ 65 | public function listTextures() 66 | { 67 | if (!$this->file) 68 | { 69 | throw new SPMException('No SPM file opened'); 70 | } 71 | if ($this->material_count === 0) 72 | { 73 | return []; 74 | } 75 | $textures = []; 76 | fseek($this->file, 30); 77 | 78 | // For each material there are 2 layers of textures reserved, if first 79 | // byte > 0 then it's the string length of the texture file if there is 80 | // a texture for that layer 81 | for ($i = 0; $i < $this->material_count; $i++) 82 | { 83 | $read_one = fread($this->file, 1); 84 | $byte_one = unpack('C', $read_one); 85 | $tex_one_size = $byte_one[1]; 86 | if ($tex_one_size > 0) 87 | { 88 | $textures[] = fread($this->file, $tex_one_size); 89 | } 90 | 91 | $read_two = fread($this->file, 1); 92 | $byte_two = unpack('C', $read_two); 93 | $tex_two_size = $byte_two[1]; 94 | if ($tex_two_size > 0) 95 | { 96 | $textures[] = fread($this->file, $tex_two_size); 97 | } 98 | } 99 | return $textures; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014-2015 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $description = _h('This is the official SuperTuxKart add-on repository. It contains extra karts and tracks for the SuperTuxKart game.'); 23 | $tpl = StkTemplate::get('index.tpl') 24 | ->assign('title', _h('SuperTuxKart Add-ons')) 25 | ->assign("show_stk_image", true) 26 | ->setMetaDesc($description) 27 | ->addScriptInclude("jquery.newsticker.js") 28 | ->addScriptInline('$("#news-messages").newsTicker();', StkTemplate::ORDER_AFTER); 29 | 30 | // Display index menu 31 | $type_kart = Addon::typeToString(Addon::KART); 32 | $type_track = Addon::typeToString(Addon::TRACK); 33 | $type_arena = Addon::typeToString(Addon::ARENA); 34 | $tpl->assign( 35 | 'index_menu', 36 | [ 37 | [ 38 | 'href' => URL::rewriteFromConfig('addons.php?type=' . $type_kart), 39 | 'label' => _h('Karts'), 40 | 'type' => $type_kart 41 | ], 42 | [ 43 | 'href' => URL::rewriteFromConfig('addons.php?type=' . $type_track), 44 | 'label' => _h('Tracks'), 45 | 'type' => $type_track 46 | ], 47 | [ 48 | 'href' => URL::rewriteFromConfig('addons.php?type=' . $type_arena), 49 | 'label' => _h('Arenas'), 50 | 'type' => $type_arena 51 | ], 52 | [ 53 | 'href' => 'https://github.com/supertuxkart/stk-addons/wiki', 54 | 'label' => 'Help', 55 | 'type' => 'help' 56 | ] 57 | ] 58 | ); 59 | 60 | // Display news messages 61 | $news_messages = News::getWebVisible(); 62 | 63 | // Note most downloaded track and kart 64 | $pop_kart = Statistic::mostDownloadedAddon(Addon::KART); 65 | $pop_track = Statistic::mostDownloadedAddon(Addon::TRACK); 66 | if ($pop_track !== null) 67 | { 68 | array_unshift( 69 | $news_messages, 70 | sprintf(_h('The most downloaded track is %s.'), $pop_track) 71 | ); 72 | } 73 | if ($pop_kart !== null) 74 | { 75 | array_unshift( 76 | $news_messages, 77 | sprintf(_h('The most downloaded kart is %s.'), $pop_kart) 78 | ); 79 | } 80 | 81 | $tpl->assign('news_messages', $news_messages); 82 | echo $tpl; 83 | -------------------------------------------------------------------------------- /install/apache.EXAMPLE.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName stk-addons.localhost 3 | DocumentRoot /var/www/stk-addons/ 4 | 5 | 6 | Options Indexes FollowSymLinks MultiViews 7 | AllowOverride All 8 | Require all granted 9 | 10 | 11 | 12 | Options Indexes FollowSymLinks MultiViews 13 | AllowOverride All 14 | Require all granted 15 | 16 | 17 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 18 | # error, crit, alert, emerg. 19 | # It is also possible to configure the loglevel for particular 20 | # modules, e.g. 21 | LogLevel info 22 | 23 | ErrorLog ${APACHE_LOG_DIR}/stk-addons-error.log 24 | CustomLog ${APACHE_LOG_DIR}/stk-addons-access.log combined 25 | 26 | -------------------------------------------------------------------------------- /install/htaccess.EXAMPLE: -------------------------------------------------------------------------------- 1 | # Error documents 2 | ErrorDocument 403 /error.php?e=403 3 | ErrorDocument 404 /error.php?e=404 4 | 5 | Options +FollowSymlinks 6 | Options -Indexes 7 | RewriteEngine on 8 | RewriteBase / 9 | 10 | # Send index.php to document root 11 | RewriteRule ^index.php$ / [NC,L,QSA,R=301] 12 | 13 | # Remove amperstands that show up sometimes 14 | RewriteCond %{QUERY_STRING} ^&+(.*)$ 15 | RewriteRule .* $0\?%1 [NC,L,R=301] 16 | 17 | # Remove duplicate 'lang' variables 18 | RewriteCond %{QUERY_STRING} ^(.*)(lang=([a-zA-Z_])+)(&.*)?&lang=[a-zA-Z_]+(.*)$ 19 | RewriteRule .* $0\?%1%2%4%5 [NC,L,R=301] 20 | 21 | # Nice add-on paths 22 | RewriteRule ^(tracks|karts|arenas)/([a-z0-9\-_]+)$ addons.php?type=$1&name=$2&rw=1 [NC,L,QSA] 23 | RewriteRule ^(tracks|karts|arenas)$ addons.php?type=$1&rw=1 [NC,L,QSA] 24 | 25 | # Redirect old add-on paths to nice new paths, be careful not to create a loop 26 | RewriteCond %{QUERY_STRING} !rw=1 27 | RewriteCond %{QUERY_STRING} ^type=(karts|tracks|arenas)$ 28 | RewriteRule addons.php %1? [L,NC,R=301] 29 | RewriteCond %{QUERY_STRING} !rw=1 30 | RewriteCond %{QUERY_STRING} ^type=(karts|tracks|arenas)&name=([a-z0-9\-_]+)$ 31 | RewriteRule addons.php %1/%2? [L,NC,R=301] 32 | 33 | # Pass download links to the download script 34 | RewriteRule ^dl/(.+) /download.php?file=$1 [NC,L] 35 | 36 | # cache images docs for 14 days 37 | 38 | 39 | Header set Cache-Control "max-age=1209600, public, must-revalidate" 40 | Header unset Last-Modified 41 | 42 | 43 | 44 | # attempt to gzip output 45 | 46 | mod_gzip_on Yes 47 | mod_gzip_dechunk Yes 48 | mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ 49 | mod_gzip_item_include handler ^cgi-script$ 50 | mod_gzip_item_include mime ^text/.* 51 | mod_gzip_item_include mime ^application/x-javascript.* 52 | mod_gzip_item_exclude mime ^image/.* 53 | mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 54 | 55 | -------------------------------------------------------------------------------- /install/index.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | function text_success($text) 22 | { 23 | return sprintf('

%s

', $text); 24 | } 25 | 26 | function text_error($text) 27 | { 28 | return sprintf('

%s

', $text); 29 | } 30 | 31 | if (get_magic_quotes_gpc()) 32 | { 33 | echo text_error('Magic Quotes GPC Enabled.'); 34 | } 35 | else 36 | { 37 | echo text_success('Magic Quotes GPC Disabled.'); 38 | } 39 | 40 | if (ini_get('register_globals')) 41 | { 42 | echo text_error('register_globals Enabled.'); 43 | } 44 | else 45 | { 46 | echo text_success('register_globals Disabled.'); 47 | } 48 | 49 | if (defined("PDO::MYSQL_ATTR_LOCAL_INFILE")) 50 | { 51 | echo text_success('MySQL extension Available.'); 52 | } 53 | else 54 | { 55 | echo text_error('MySQL extension Not Available'); 56 | } 57 | 58 | if (extension_loaded("zip")) 59 | { 60 | echo text_success('Zip Available.'); 61 | } 62 | else 63 | { 64 | echo text_error('Zip Not Available'); 65 | } 66 | 67 | if (extension_loaded("gettext")) 68 | { 69 | echo text_success('Gettext Available.'); 70 | } 71 | else 72 | { 73 | echo text_error('Gettext Not Available.'); 74 | } 75 | 76 | if (extension_loaded("xml")) 77 | { 78 | echo text_success('XML is Available.'); 79 | } 80 | else 81 | { 82 | echo text_error('XML Not Available.'); 83 | } 84 | 85 | if (extension_loaded("pdo")) 86 | { 87 | echo text_success("PDO is Available"); 88 | } 89 | else 90 | { 91 | echo text_error("PDO Not Available"); 92 | } 93 | 94 | if (extension_loaded("mbstring")) 95 | { 96 | echo text_success("mbstring is Available"); 97 | } 98 | else 99 | { 100 | echo text_error("mbstring Not Available"); 101 | } 102 | 103 | // Check for GD 104 | if (extension_loaded('gd')) 105 | { 106 | $image_types = imagetypes(); 107 | $supported = []; 108 | if ($image_types & IMG_GIF) 109 | { 110 | $supported[] = 'GIF'; 111 | } 112 | if ($image_types & IMG_PNG) 113 | { 114 | $supported[] = 'PNG'; 115 | } 116 | if ($image_types & IMG_JPG) 117 | { 118 | $supported[] = 'JPG'; 119 | } 120 | if ($image_types & IMG_WBMP) 121 | { 122 | $supported[] = 'WBMP'; 123 | } 124 | if ($image_types & IMG_XPM) 125 | { 126 | $supported[] = "XPM"; 127 | } 128 | 129 | echo text_success('GD Available, and supports the following image types: ' . implode(", ", $supported)); 130 | } 131 | else 132 | { 133 | echo text_error('GD Not Available.'); 134 | } 135 | -------------------------------------------------------------------------------- /install/nginx.EXAMPLE.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name stk-addons.localhost; 4 | root /var/www/stk-addons/; 5 | index index.php; 6 | 7 | location ~/api { 8 | root /var/www/stk-addons/api/; 9 | index /index.php; 10 | fastcgi_split_path_info ^(.+\.php)(.*)$; 11 | 12 | fastcgi_pass php_default; 13 | include fastcgi_params; 14 | 15 | fastcgi_param SCRIPT_FILENAME $document_root/index.php; 16 | } 17 | 18 | location ~ .*\.php$ { 19 | try_files $uri $uri/ index.php?q=$uri&$args; 20 | fastcgi_index index.php; 21 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 22 | 23 | fastcgi_pass php_default; 24 | include fastcgi_params; 25 | 26 | fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; 27 | 28 | include fastcgi_params; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /install/uninstall.sql: -------------------------------------------------------------------------------- 1 | -- drop procedures 2 | DROP PROCEDURE IF EXISTS v3_create_file_record; 3 | 4 | -- drop tables 5 | DROP TABLE IF EXISTS v3_bugs_comments; 6 | DROP TABLE IF EXISTS v3_bugs; 7 | DROP TABLE IF EXISTS v3_votes; 8 | DROP TABLE IF EXISTS v3_addon_revisions; 9 | DROP TABLE IF EXISTS v3_cache; 10 | DROP TABLE IF EXISTS v3_files_delete; 11 | DROP TABLE IF EXISTS v3_files; 12 | DROP TABLE IF EXISTS v3_file_types; 13 | DROP TABLE IF EXISTS v3_addons; 14 | DROP TABLE IF EXISTS v3_addon_types; 15 | 16 | DROP TABLE IF EXISTS v3_server_conn; 17 | DROP TABLE IF EXISTS v3_servers; 18 | DROP TABLE IF EXISTS v3_host_votes; 19 | DROP TABLE IF EXISTS v3_client_sessions; 20 | DROP TABLE IF EXISTS v3_news; 21 | DROP TABLE IF EXISTS v3_logs; 22 | DROP TABLE IF EXISTS v3_notifications; 23 | DROP TABLE IF EXISTS v3_friends; 24 | DROP TABLE IF EXISTS v3_achieved; 25 | DROP TABLE IF EXISTS v3_achievements; 26 | DROP TABLE IF EXISTS v3_verification; 27 | DROP TABLE IF EXISTS v3_users; 28 | DROP TABLE IF EXISTS v3_role_permissions; 29 | DROP TABLE IF EXISTS v3_roles; 30 | 31 | DROP TABLE IF EXISTS v3_stats; 32 | DROP TABLE IF EXISTS v3_config; 33 | DROP TABLE IF EXISTS v3_music; 34 | DROP TABLE IF EXISTS v3_clients; 35 | DROP TABLE IF EXISTS v3_ipv4_mapping; 36 | DROP TABLE IF EXISTS v3_rankings; 37 | -------------------------------------------------------------------------------- /json/image_list.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | /** 22 | * json/image_list.php 23 | * This file provides a json-formatted list of all available images for an 24 | * addon passed through the "id" parameter. 25 | */ 26 | 27 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 28 | 29 | header("Content-Type: application/json"); 30 | // Quit if no ID was passed 31 | if (!isset($_GET['id'])) 32 | { 33 | header('HTTP/1.0 404 Not Found'); 34 | exit; 35 | } 36 | 37 | $addon_id = $_GET['id']; 38 | if (!Addon::exists($addon_id)) 39 | { 40 | header('HTTP/1.0 404 Not Found'); 41 | exit; 42 | } 43 | 44 | // Addon exists, get images 45 | $addon = Addon::get($addon_id); 46 | 47 | $json_array = []; 48 | foreach ($addon->getImages() as $image) 49 | { 50 | $json_array[] = [ 51 | 'url' => DOWNLOAD_LOCATION . $image->getPath(), 52 | 'date' => strtotime($image->getDateAdded()), 53 | 'approved' => $image->isApproved() 54 | ]; 55 | } 56 | echo json_encode($json_array); 57 | -------------------------------------------------------------------------------- /json/license.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | // TODO find usage for this file or delete it 22 | /** 23 | * json/image_list.php 24 | * This file provides a json-formatted list of all available images for an 25 | * addon passed through the "id" parameter. 26 | */ 27 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 28 | 29 | header("Content-Type: application/json"); 30 | // Quit if no ID was passed 31 | if (!isset($_GET['id'])) 32 | { 33 | header('HTTP/1.0 404 Not Found'); 34 | exit; 35 | } 36 | 37 | $addon_id = $_GET['id']; 38 | if (!Addon::exists($addon_id)) 39 | { 40 | header('HTTP/1.0 404 Not Found'); 41 | exit; 42 | } 43 | 44 | // Addon exists, get images 45 | $addon = Addon::get($addon_id); 46 | 47 | // This isn't really JSON, but no reason to wrap one value in braces 48 | echo h($addon->getLicense()); 49 | -------------------------------------------------------------------------------- /json/rating.php: -------------------------------------------------------------------------------- 1 | 5 | * 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | header("Content-Type: application/json"); 24 | if (empty($_GET['addon-id'])) 25 | { 26 | exit_json_error('No addon id provided'); 27 | } 28 | 29 | if (!isset($_GET["action"])) 30 | { 31 | exit_json_error("action param is not defined or is empty"); 32 | } 33 | 34 | if (!Addon::exists($_GET['addon-id'])) 35 | { 36 | exit_json_error('The addon does not exist ' . h($_GET['addon-id'])); 37 | } 38 | if (!User::isLoggedIn()) 39 | { 40 | exit_json_error("You are not logged in"); 41 | } 42 | 43 | $rating = Rating::get($_GET['addon-id']); 44 | switch ($_GET['action']) 45 | { 46 | case "set": // set rating and get the overall rating 47 | if (empty($_GET["rating"])) 48 | { 49 | exit_json_error("Rating param is not defined or is empty"); 50 | } 51 | 52 | // set rating 53 | try 54 | { 55 | $rating->setUserVote(User::getLoggedId(), (float)$_GET['rating']); 56 | } 57 | catch(RatingsException $e) 58 | { 59 | exit_json_error($e->getMessage()); 60 | } 61 | 62 | exit_json_success("Rating set", ["width" => $rating->getAvgRatingPercent(), "num-ratings" => $rating->getRatingString()]); 63 | break; 64 | 65 | case "get": // get overall rating 66 | exit_json_success("", ["width" => $rating->getAvgRatingPercent(), "num-ratings" => $rating->getRatingString()]); 67 | break; 68 | 69 | default: 70 | exit_json_error(sprintf("action = %s is not recognized", h($_GET["action"]))); 71 | break; 72 | } 73 | -------------------------------------------------------------------------------- /locale/ca_ES/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/ca_ES/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/de_DE/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/de_DE/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/es_ES/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/es_ES/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/eu_ES/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/eu_ES/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/fr_FR/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/fr_FR/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/ga_IE/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/ga_IE/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/gd_GB/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/gd_GB/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/generate-mo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make bash sane 4 | set -eu -o pipefail 5 | DIR=$(basename "$PWD") 6 | if [[ "$DIR" != "locale" ]]; then 7 | echo "You are not inside the 'locale' directory" 8 | echo "ABORTING." 9 | exit 0 10 | fi 11 | 12 | echo "Generating .mo files" 13 | 14 | msgfmt translations-ca.po -o ca_ES/LC_MESSAGES/translations.mo 15 | msgfmt translations-es.po -o es_ES/LC_MESSAGES/translations.mo 16 | msgfmt translations-eu.po -o eu_ES/LC_MESSAGES/translations.mo 17 | msgfmt translations-fr.po -o fr_FR/LC_MESSAGES/translations.mo 18 | msgfmt translations-ga.po -o ga_IE/LC_MESSAGES/translations.mo 19 | msgfmt translations-gd.po -o gd_GB/LC_MESSAGES/translations.mo 20 | msgfmt translations-gl.po -o gl_ES/LC_MESSAGES/translations.mo 21 | msgfmt translations-hu.po -o hu_HU/LC_MESSAGES/translations.mo 22 | msgfmt translations-it.po -o it_IT/LC_MESSAGES/translations.mo 23 | msgfmt translations-nl.po -o nl_NL/LC_MESSAGES/translations.mo 24 | msgfmt translations-de.po -o de_DE/LC_MESSAGES/translations.mo 25 | msgfmt translations-pt_BR.po -o pt_BR/LC_MESSAGES/translations.mo 26 | msgfmt translations-ru.po -o ru_RU/LC_MESSAGES/translations.mo 27 | msgfmt translations-id.po -o id_ID/LC_MESSAGES/translations.mo 28 | msgfmt translations-zh_TW.po -o zh_TW/LC_MESSAGES/translations.mo 29 | 30 | echo "DONE" 31 | -------------------------------------------------------------------------------- /locale/gl_ES/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/gl_ES/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/hu_HU/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/hu_HU/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/id_ID/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/id_ID/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/it_IT/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/it_IT/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/locale-gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make bash sane 4 | set -eu -o pipefail 5 | DIR=$(basename "$PWD") 6 | if [[ "$DIR" != "locale" ]]; then 7 | echo "You are not inside the 'locale' directory" 8 | echo "ABORTING." 9 | exit 0 10 | fi 11 | 12 | function install() 13 | { 14 | if [[ ! -f "/usr/share/i18n/SUPPORTED" ]]; then 15 | echo "Supported locales files does not exist" 16 | echo "ABORTING" 17 | exit 0 18 | fi 19 | 20 | for dir in *; do 21 | if [[ -d $dir ]]; then 22 | local loc="$dir.UTF-8" 23 | if grep -q "$loc" /usr/share/i18n/SUPPORTED; then 24 | sudo locale-gen $loc 25 | else 26 | echo "$loc locale is NOT supported" 27 | fi 28 | fi 29 | done 30 | } 31 | 32 | echo "This script will generate all the required locales for stk-addons and install them system wide (locale-gen)" 33 | echo "" 34 | 35 | read -p "Are you sure you want to continue? " prompt 36 | if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then 37 | install 38 | else 39 | echo "ABORTING." 40 | exit 0 41 | fi 42 | -------------------------------------------------------------------------------- /locale/nl_NL/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/nl_NL/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/pt_BR/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/pt_BR/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/ru_RU/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/ru_RU/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /locale/translations-ga.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: stk addons\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2010-01-30 19:15+0100\n" 6 | "PO-Revision-Date: \n" 7 | "Last-Translator: Aaron Kearns \n" 8 | "Language-Team: Aaron Kearns \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Poedit-Language: ga\n" 13 | 14 | #: coreAddon.php:118 15 | #: upload.php:47 16 | msgid "Name :" 17 | msgstr "Ainm :" 18 | 19 | #: coreAddon.php:122 20 | msgid "Description :" 21 | msgstr "Tuairisc :" 22 | 23 | #: coreAddon.php:126 24 | msgid "Version :" 25 | msgstr "Leagan :" 26 | 27 | #: coreAddon.php:129 28 | msgid "Version of STK :" 29 | msgstr "Leagan STK :" 30 | 31 | #: coreAddon.php:133 32 | msgid "Author :" 33 | msgstr "Údar :" 34 | 35 | #: index.php:55 36 | msgid "Add-ons for Supertuxkart 0.7" 37 | msgstr "Forlíontáin do SuperTuxKart 0.7" 38 | 39 | #: index.php:60 40 | msgid "Karts" 41 | msgstr "Cairtíní" 42 | 43 | #: index.php:64 44 | msgid "Tracks" 45 | msgstr "Raonta" 46 | 47 | #: index.php:68 48 | msgid "Help" 49 | msgstr "Cabhair" 50 | 51 | #: login.php:78 52 | #: menu.php:37 53 | msgid "Welcome" 54 | msgstr "Fáilte" 55 | 56 | #: login.php:79 57 | msgid "You will be redirected to the home page." 58 | msgstr "Beidh tú atreoraithe chun an leathanach baile." 59 | 60 | #: login.php:95 61 | msgid "Authentification failed." 62 | msgstr "Fíordheimhniú teipthe." 63 | 64 | #: login.php:116 65 | msgid "You must be logged in to access this page." 66 | msgstr "Caithfidh go bhfuil tú logáilte isteach rochtain an leathanach seo." 67 | 68 | #: login.php:122 69 | msgid "Create an account." 70 | msgstr "Cruthaigh cuntas." 71 | 72 | #: menu.php:40 73 | msgid "Home" 74 | msgstr "Baile" 75 | 76 | #: menu.php:44 77 | msgid "Log out" 78 | msgstr "Logáil amach" 79 | 80 | #: menu.php:45 81 | msgid "Users" 82 | msgstr "Úsáideoirí" 83 | 84 | #: menu.php:46 85 | msgid "Upload" 86 | msgstr "Uaslódáil" 87 | 88 | #: menu.php:52 89 | msgid "Login" 90 | msgstr "Logáil isteach" 91 | 92 | #: upload.php:48 93 | msgid "Description, it must be in english :" 94 | msgstr "Tuairisc, caithfidh go bhfuil as Béarla :" 95 | 96 | #: upload.php:49 97 | msgid "Image, it must be a .png :" 98 | msgstr "Íomhá, caithfidh go bhfuil .png :" 99 | 100 | #: upload.php:50 101 | msgid "Icon (kart only), it must be a .png :" 102 | msgstr "Deilbhín, caithfidh go bhfuil .png :" 103 | 104 | #: upload.php:51 105 | msgid "Addon's file, it must be a .zip :" 106 | msgstr "Comhad, caithfidh go bhfuil .zip :" 107 | 108 | -------------------------------------------------------------------------------- /locale/update-pot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make bash sane 4 | set -eu -o pipefail 5 | DIR=$(basename "$PWD") 6 | if [[ "$DIR" != "locale" ]]; then 7 | echo "You are not inside the 'locale' directory" 8 | echo "ABORTING." 9 | exit 0 10 | fi 11 | 12 | echo "Creating php files index (file-list.txt)" 13 | rm -f file-list.txt 14 | ls ../*.php >> ./file-list.txt 15 | ls ../include/*.php >> ./file-list.txt 16 | ls ../stats/*.php >> ./file-list.txt 17 | ls ../bugs/*.php >> ./file-list.txt 18 | ls ../json/*.php >> ./file-list.txt 19 | 20 | echo "Generating from code" 21 | xgettext \ 22 | --language=php \ 23 | --keyword=_h \ 24 | --output=./code.pot \ 25 | --msgid-bugs-address=supertuxkart-translations@lists.sourceforge.net \ 26 | --add-comments=I18N \ 27 | --copyright-holder="SuperTuxKart Team" \ 28 | --package-name=stk-addons -Fn \ 29 | --files-from=file-list.txt 30 | 31 | echo "Generating from templates" 32 | ../vendor/bin/tsmarty2c.php -o template.pot ../tpl 33 | 34 | echo "Concatenating" 35 | msgcat -o translations.pot code.pot template.pot 36 | 37 | echo "Cleaning up" 38 | rm -f code.pot template.pot 39 | 40 | echo "DONE" 41 | -------------------------------------------------------------------------------- /locale/zh_TW/LC_MESSAGES/translations.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supertuxkart/stk-addons/9f06b9537f727e2134a512ef0e7f5b64ac776b77/locale/zh_TW/LC_MESSAGES/translations.mo -------------------------------------------------------------------------------- /manage.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | AccessControl::setLevel(AccessControl::PERM_EDIT_ADDONS); 22 | 23 | $_GET['action'] = (isset($_GET['action'])) ? $_GET['action'] : null; 24 | $_GET['view'] = (isset($_GET['view'])) ? $_GET['view'] : 'overview'; 25 | 26 | $tpl = StkTemplate::get("manage/index.tpl") 27 | ->assignTitle(_h("Manage")) 28 | ->addUtilLibrary() 29 | ->addDataTablesLibrary() 30 | ->addScriptInclude("manage.js") 31 | ->assign("can_edit_settings", User::hasPermission(AccessControl::PERM_EDIT_SETTINGS)) 32 | ->assign("can_edit_roles", User::hasPermission(AccessControl::PERM_EDIT_PERMISSIONS)); 33 | $tpl_data = ["status" => "", "body" => ""]; 34 | 35 | // right panel 36 | $tpl_data["body"] = Util::ob_get_require_once(ROOT_PATH . "manage-panel.php"); 37 | 38 | // output the view 39 | $tpl->assign("manage", $tpl_data); 40 | echo $tpl; 41 | -------------------------------------------------------------------------------- /music.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $tpl = StkTemplate::get('music-browser.tpl')->assignTitle(_h('Browse Music')); 23 | 24 | $music_tracks = Music::getAllByTitle(); 25 | $music_data = []; 26 | foreach ($music_tracks as $track) 27 | { 28 | $music_data[] = $track->getTitle(); 29 | $music_data[] = $track->getArtist(); 30 | $music_data[] = $track->getLicense(); 31 | $music_data[] = '' . $track->getFile() . ''; 32 | } 33 | 34 | $tpl->assign( 35 | 'music_browser', 36 | [ 37 | 'cols' => [ 38 | _h('Track Title'), 39 | _h('Track Artist'), 40 | _h('License'), 41 | _h('File') 42 | ], 43 | 'data' => $music_data 44 | ] 45 | ); 46 | 47 | echo $tpl; 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@bower_components/bootbox": "makeusabrew/bootbox#~4.3", 4 | "@bower_components/bootstrap": "twbs/bootstrap#~3.3", 5 | "@bower_components/bootstrap-fileinput": "kartik-v/bootstrap-fileinput#~2.8", 6 | "@bower_components/bootstrap-hover-dropdown": "CWSpear/twitter-bootstrap-hover-dropdown#~2.0", 7 | "@bower_components/bootstrap-multiselect": "Benau/bootstrap-multiselect#~0.9", 8 | "@bower_components/bootstrap-select": "snapappointments/bootstrap-select#~1.6", 9 | "@bower_components/bootstrap.notify": "mouse0270/bootstrap-notify#~3.1", 10 | "@bower_components/bootstrap3-wysihtml5-bower": "Waxolunist/bootstrap3-wysihtml5-bower#~0.3", 11 | "@bower_components/bootstrapValidator": "nghuuphuoc/bootstrapvalidator#~0.5", 12 | "@bower_components/components-font-awesome": "components/font-awesome#~4.1.0", 13 | "@bower_components/datatables": "DataTables/DataTables#>= 1.9.4", 14 | "@bower_components/datatables-bootstrap3": "Jowin/Datatables-Bootstrap3#*", 15 | "@bower_components/flot": "flot/flot#~0.8", 16 | "@bower_components/flot.tooltip": "krzysu/flot.tooltip#~0.8", 17 | "@bower_components/handlebars": "components/handlebars.js#~1.3.0", 18 | "@bower_components/jquery": "jquery/jquery-dist#~1.11", 19 | "@bower_components/rangy-1.3": "noap/rangy-1.3#master", 20 | "@bower_components/typeahead.js": "twitter/typeahead.js#~0.10", 21 | "@bower_components/underscore": "jashkenas/underscore#~1.7", 22 | "@bower_components/wysihtml5x": "Edicy/wysihtml5#0.4.13", 23 | "yarn-upgrade-all": "^0.5.4" 24 | }, 25 | "private": true, 26 | "engines": { 27 | "yarn": ">= 1.0.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /phpcs/Sniffs/ControlSignatureSniff.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600) 7 | * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence 8 | */ 9 | 10 | namespace StkAddons\Sniffs\ControlStructures; 11 | 12 | use PHP_CodeSniffer\Sniffs\AbstractPatternSniff; 13 | 14 | final class ControlSignatureSniff extends AbstractPatternSniff 15 | { 16 | /** 17 | * If true, comments will be ignored if they are found in the code. 18 | * 19 | * @var boolean 20 | */ 21 | public $ignoreComments = true; 22 | 23 | /** 24 | * Returns the patterns that should be checked. 25 | * 26 | * @return string[] 27 | */ 28 | protected function getPatterns() 29 | { 30 | return [ 31 | 'doEOL...{EOL...} while (...);EOL', 32 | 'while (...)EOL...{EOL', 33 | 'for (...)EOL...{EOL', 34 | 'if (...)EOL...{EOL', 35 | 'foreach (...)EOL...{EOL', 36 | '}EOL...else if (...)EOL...{EOL', 37 | '}EOL...elseif (...)EOL...{EOL', 38 | '}EOL...elseEOL...{EOL', 39 | 'doEOL...{EOL', 40 | ]; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /phpcs/ruleset.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | assets/ 7 | config.php 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /phpstan/config.phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | autoload_files: 3 | - phpstan/config.example_install_for_phpstan.php 4 | 5 | autoload_directories: 6 | - tests/include 7 | 8 | excludes_analyse: 9 | - install 10 | - config.php 11 | - assets 12 | - phpstan 13 | - phpcs 14 | - tools 15 | - vendor 16 | - upload.php 17 | 18 | ignoreErrors: 19 | # - 20 | # message: '~^If condition is always true\.$~' 21 | # path: 'include/ClientSession.class.php' 22 | # - 23 | # message: '~^If condition is always true\.$~' 24 | # path: 'include/Statistic.class.php' 25 | # - 26 | # message: '~^Offset int does not exist on array\(\)\|array\(int\)\.$~' 27 | # path: 'include/StkImage.class.php' 28 | - '~^Parameter \#2 \$value of method XMLWriter::writeAttribute\(\) expects string, (?:int|float) given\.$~' 29 | - '~^Parameter \#2 \$value of method XMLWriter::writeAttribute\(\) expects string, \(int\|false\) given\.$~' 30 | 31 | level: 5 32 | 33 | rules: 34 | #- PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRule 35 | #- PHPStan\Rules\BooleansInConditions\BooleanInBooleanNotRule 36 | #- PHPStan\Rules\BooleansInConditions\BooleanInBooleanOrRule 37 | #- PHPStan\Rules\BooleansInConditions\BooleanInElseIfConditionRule 38 | #- PHPStan\Rules\BooleansInConditions\BooleanInIfConditionRule 39 | #- PHPStan\Rules\BooleansInConditions\BooleanInTernaryOperatorRule 40 | #- PHPStan\Rules\DisallowedConstructs\DisallowedEmptyRule 41 | - PHPStan\Rules\DisallowedConstructs\DisallowedImplicitArrayCreationRule 42 | - PHPStan\Rules\Functions\MissingFunctionParameterTypehintRule 43 | - PHPStan\Rules\Functions\MissingFunctionReturnTypehintRule 44 | - PHPStan\Rules\Methods\MissingMethodParameterTypehintRule 45 | - PHPStan\Rules\Methods\MissingMethodReturnTypehintRule 46 | - PHPStan\Rules\Methods\WrongCaseOfInheritedMethodRule 47 | - PHPStan\Rules\Operators\OperandsInArithmeticAdditionRule 48 | - PHPStan\Rules\Operators\OperandsInArithmeticDivisionRule 49 | - PHPStan\Rules\Operators\OperandsInArithmeticExponentiationRule 50 | - PHPStan\Rules\Operators\OperandsInArithmeticModuloRule 51 | - PHPStan\Rules\Operators\OperandsInArithmeticMultiplicationRule 52 | - PHPStan\Rules\Operators\OperandsInArithmeticSubtractionRule 53 | - PHPStan\Rules\Properties\MissingPropertyTypehintRule 54 | - PHPStan\Rules\StrictCalls\DynamicCallOnStaticMethodsRule 55 | #- PHPStan\Rules\StrictCalls\StrictFunctionCallsRule 56 | - PHPStan\Rules\SwitchConditions\MatchingTypeInSwitchCaseConditionRule 57 | 58 | services: 59 | - 60 | class: PHPStan\Rules\BooleansInConditions\BooleanRuleHelper 61 | - 62 | class: PHPStan\Rules\Operators\OperatorRuleHelper 63 | 64 | dynamicConstantNames: 65 | - API_MODE 66 | - CRON_MODE 67 | - DEBUG_MODE 68 | - DEBUG_TOOLBAR 69 | - IS_SMTP 70 | - IS_SSL_CERTIFICATE_VALID 71 | - MAINTENANCE_MODE 72 | - SENDMAIL_PATH 73 | - TEST_MODE 74 | 75 | includes: 76 | # phpunit extension and rules 77 | - ../vendor/phpstan/phpstan-phpunit/extension.neon 78 | - ../vendor/phpstan/phpstan-phpunit/rules.neon 79 | 80 | # webmozart/assert extension 81 | - ../vendor/phpstan/phpstan-webmozart-assert/extension.neon 82 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ./tests/ 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /privacy.php: -------------------------------------------------------------------------------- 1 | 4 | * 2014 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = new StkTemplate('privacy.tpl'); 24 | $tpl->assignTitle(_h('Privacy')); 25 | 26 | echo $tpl; 27 | -------------------------------------------------------------------------------- /rankings.php: -------------------------------------------------------------------------------- 1 | . 18 | */ 19 | 20 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 21 | 22 | $tpl = StkTemplate::get('rankings.tpl') 23 | ->addDataTablesLibrary() 24 | ->addScriptInclude("stats.js"); 25 | 26 | $tpl->assignTitle(_h('Player Rankings')); 27 | 28 | // disconnects is a 64bit bitflag, 29 | // divide it with min(num_races_done, 64) for races done < 64 to have correct value 30 | $query_rankings = << [ Statistic::getSection($query_rankings) ] ]; 48 | 49 | $tpl->assign("player_rankings", $player_data); 50 | 51 | echo $tpl; 52 | -------------------------------------------------------------------------------- /stats/addons.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/page/addons.tpl"); 24 | $file_type_addon = File::ADDON; 25 | 26 | $query_addon_revisions = << [ 71 | Statistic::getChart($query_addon_type, Statistic::CHART_PIE, "Add-On Types", "addon_type_pie"), 72 | Statistic::getSection($query_addon_revisions, "Add-Ons (by revision)"), 73 | Statistic::getSection($query_addon_cumulative, "Add-Ons Cumulative Downloads"), 74 | Statistic::getSection($query_addon_user, "Add-Ons - user combination") 75 | ], 76 | ]; 77 | 78 | $tpl->assign("addons", $tpl_data); 79 | echo $tpl; 80 | -------------------------------------------------------------------------------- /stats/clients.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/page/clients.tpl"); 24 | 25 | $query_version = <<= CURDATE() - INTERVAL 1 YEAR 30 | AND `type` LIKE 'uagent %' 31 | ORDER BY `date` DESC 32 | ) AS `t` 33 | GROUP BY `t`.`date`, `t`.`label` 34 | ORDER BY `t`.`date` DESC, `t`.`label` DESC 35 | SQL; 36 | 37 | $query_time = <<= CURDATE() - INTERVAL 1 YEAR 43 | AND `type` LIKE 'uagent %' 44 | ORDER BY `date` DESC 45 | ) AS `t` 46 | GROUP BY `t`.`date`,`t`.`label` 47 | ORDER BY `t`.`date` DESC, `t`.`label` DESC 48 | SQL; 49 | 50 | $tpl_data = [ 51 | "sections" => [ 52 | Statistic::getChart($query_version, Statistic::CHART_TIME, "File Downloads per Version in the Last Year", "downloads_version_year"), 53 | Statistic::getChart($query_time, Statistic::CHART_TIME, "File Downloads per OS in the Last Year", "downloads_os_year") 54 | ] 55 | ]; 56 | 57 | $tpl->assign("clients", $tpl_data); 58 | echo $tpl; 59 | -------------------------------------------------------------------------------- /stats/files.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/page/files.tpl"); 24 | 25 | $query_images = <<= CURDATE() - INTERVAL 30 DAY 53 | GROUP BY `date` 54 | ORDER BY `date` DESC 55 | SQL; 56 | 57 | $query_file_downloads_months_12 = <<= CURDATE() - INTERVAL 1 YEAR 61 | GROUP BY `year`, MONTH(`date`), `month` 62 | ORDER BY `year` DESC, MONTH(`date`) DESC 63 | SQL; 64 | 65 | $file_type_addon = File::ADDON; 66 | $query_downloads_addon_type = << [ 80 | Statistic::getChart( 81 | $query_downloads_addon_type, 82 | Statistic::CHART_PIE, 83 | "File Downloads (by add-on type)", 84 | "files_pie" 85 | ), 86 | Statistic::getSection($query_file_downloads_month_30, "File Downloads in the Last 30 Days"), 87 | Statistic::getSection($query_file_downloads_months_12, "File Downloads per Month in the Last 12 Months"), 88 | Statistic::getSection($query_images, "Images"), 89 | Statistic::getSection($query_source, "Source") 90 | ], 91 | ]; 92 | 93 | $tpl->assign("files", $tpl_data); 94 | echo $tpl; 95 | -------------------------------------------------------------------------------- /stats/index.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/index.tpl") 24 | ->addDataTablesLibrary() 25 | ->addFlotLibrary() 26 | ->addUtilLibrary() 27 | ->addScriptInclude("stats.js"); 28 | $tpl_data = [ 29 | "online" => Statistic::onlineClientUsers(), 30 | ]; 31 | 32 | if (isset($_GET["addons"])) 33 | { 34 | $tpl->assignTitle(_h("Addon stats")); 35 | $tpl_data["body"] = Util::ob_get_require_once(STATS_PATH . "addons.php"); 36 | } 37 | elseif (isset($_GET["files"])) 38 | { 39 | $tpl->assignTitle(_h("File stats")); 40 | $tpl_data["body"] = Util::ob_get_require_once(STATS_PATH . "files.php"); 41 | } 42 | elseif (isset($_GET["clients"])) 43 | { 44 | $tpl->assignTitle(_h("Client stats")); 45 | $tpl_data["body"] = Util::ob_get_require_once(STATS_PATH . "clients.php"); 46 | } 47 | elseif (isset($_GET["servers"])) 48 | { 49 | $tpl->assignTitle(_h("Server stats")); 50 | $tpl_data["body"] = Util::ob_get_require_once(STATS_PATH . "servers.php"); 51 | } 52 | else // display overview 53 | { 54 | $tpl->assignTitle(_h("Stats Overview")); 55 | $tpl_data["body"] = Util::ob_get_require_once(STATS_PATH . "overview.php"); 56 | } 57 | 58 | $tpl->assign("stats", $tpl_data); 59 | echo $tpl; 60 | -------------------------------------------------------------------------------- /stats/overview.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/page/overview.tpl"); 24 | $tpl_data = [ 25 | "json" => [ 26 | "addons" => Statistic::getCacheLocation("addon_type_pie"), 27 | "files" => Statistic::getCacheLocation("files_pie"), 28 | "clients" => Statistic::getCacheLocation("downloads_os_year"), 29 | "servers" => "" 30 | ] 31 | ]; 32 | 33 | $tpl->assign("overview", $tpl_data); 34 | echo $tpl; 35 | -------------------------------------------------------------------------------- /stats/servers.php: -------------------------------------------------------------------------------- 1 | 4 | * 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 22 | 23 | $tpl = StkTemplate::get("stats/page/servers.tpl"); 24 | $tpl_data = [ 25 | "sections" => [] 26 | ]; 27 | 28 | $tpl->assign("servers", $tpl_data); 29 | echo $tpl; 30 | -------------------------------------------------------------------------------- /tests/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all 2 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | define("TEST_MODE", true); 21 | require_once("install/config.EXAMPLE.php"); 22 | require_once("vendor/autoload.php"); 23 | -------------------------------------------------------------------------------- /tests/include/AddonTest.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | class AddonTest extends \PHPUnit\Framework\TestCase 21 | { 22 | public function testAddonFlags() 23 | { 24 | $all_flags = F_APPROVED + F_ALPHA + F_BETA + F_RC + F_INVISIBLE + F_DFSG + F_FEATURED + F_LATEST + F_TEX_NOT_POWER_OF_2; 25 | 26 | $this->assertTrue(Addon::isApproved(F_APPROVED)); 27 | $this->assertTrue(Addon::isApproved($all_flags)); 28 | $this->assertFalse(Addon::isApproved(8)); 29 | 30 | $this->assertTrue(Addon::isAlpha(F_ALPHA)); 31 | $this->assertTrue(Addon::isAlpha($all_flags)); 32 | $this->assertFalse(Addon::isAlpha(4)); 33 | 34 | $this->assertTrue(Addon::isBeta(F_BETA)); 35 | $this->assertTrue(Addon::isBeta($all_flags)); 36 | $this->assertFalse(Addon::isBeta(2)); 37 | 38 | $this->assertTrue(Addon::isReleaseCandidate(F_RC)); 39 | $this->assertTrue(Addon::isReleaseCandidate($all_flags)); 40 | $this->assertFalse(Addon::isReleaseCandidate(7)); 41 | 42 | $this->assertTrue(Addon::isInvisible(F_INVISIBLE)); 43 | $this->assertTrue(Addon::isInvisible($all_flags)); 44 | $this->assertFalse(Addon::isInvisible(7)); 45 | 46 | $this->assertTrue(Addon::isDFSGCompliant(F_DFSG)); 47 | $this->assertTrue(Addon::isDFSGCompliant($all_flags)); 48 | $this->assertFalse(Addon::isDFSGCompliant(7)); 49 | 50 | $this->assertTrue(Addon::isFeatured(F_FEATURED)); 51 | $this->assertTrue(Addon::isFeatured($all_flags)); 52 | $this->assertFalse(Addon::isFeatured(7)); 53 | 54 | $this->assertTrue(Addon::isLatest(F_LATEST)); 55 | $this->assertTrue(Addon::isLatest($all_flags)); 56 | $this->assertFalse(Addon::isLatest(7)); 57 | 58 | $this->assertTrue(Addon::isTextureInvalid(F_TEX_NOT_POWER_OF_2)); 59 | $this->assertTrue(Addon::isTextureInvalid($all_flags)); 60 | $this->assertFalse(Addon::isTextureInvalid(7)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/include/CacheTest.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | class CacheTest extends \PHPUnit\Framework\TestCase 21 | { 22 | public function providerTestGetCachePrefix() 23 | { 24 | return [ 25 | ['100--', Cache::getCachePrefix(999)], 26 | ['100--', Cache::getCachePrefix(-999)], 27 | ['300--', Cache::getCachePrefix(StkImage::SIZE_LARGE)], 28 | ['75--', Cache::getCachePrefix(StkImage::SIZE_MEDIUM)], 29 | ['25--', Cache::getCachePrefix(StkImage::SIZE_SMALL)] 30 | ]; 31 | } 32 | 33 | /** 34 | * @param string $expected 35 | * @param string $actual 36 | * 37 | * @dataProvider providerTestGetCachePrefix 38 | */ 39 | public function testGetCachePrefix($expected, $actual) 40 | { 41 | $this->assertEquals($expected, $actual); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/include/DBExceptionTest.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | class DBExceptionTest extends \PHPUnit\Framework\TestCase 21 | { 22 | public function testThrowExceptionSqlCode() 23 | { 24 | $message = 'test'; 25 | $error = ErrorType::DB_GENERIC; 26 | $sql_error = 'random_sql_code'; 27 | 28 | try 29 | { 30 | throw DBException::get($message, $error)->setSqlErrorCode($sql_error); 31 | } 32 | catch (DBException $e) 33 | { 34 | $this->assertEquals($e->getMessage(), $message); 35 | $this->assertEquals($e->getCode(), $error); 36 | $this->assertEquals($e->getSqlErrorCode(), $sql_error); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/include/StkImageTest.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | class StkImageTest extends \PHPUnit\Framework\TestCase 21 | { 22 | public function providerTestSizeToInt() 23 | { 24 | return [ 25 | [100, StkImage::sizeToInt(StkImage::SIZE_DEFAULT)], 26 | [100, StkImage::sizeToInt('9999')], 27 | [100, StkImage::sizeToInt(514949489)], 28 | [25, StkImage::sizeToInt(StkImage::SIZE_SMALL)], 29 | [75, StkImage::sizeToInt(StkImage::SIZE_MEDIUM)], 30 | [300, StkImage::sizeToInt(StkImage::SIZE_LARGE)], 31 | 32 | ]; 33 | } 34 | 35 | /** 36 | * @param int $expected 37 | * @param int $actual 38 | * 39 | * @dataProvider providerTestSizeToInt 40 | */ 41 | public function testSizeToInt($expected, $actual) 42 | { 43 | $this->assertEquals($expected, $actual); 44 | } 45 | 46 | public function providerTestIntToSize() 47 | { 48 | return [ 49 | [StkImage::SIZE_DEFAULT, StkImage::intToSize('999999')], 50 | [StkImage::SIZE_DEFAULT, StkImage::intToSize(5454488)], 51 | [StkImage::SIZE_SMALL, StkImage::intToSize(25)], 52 | [StkImage::SIZE_MEDIUM, StkImage::intToSize(75)], 53 | [StkImage::SIZE_LARGE, StkImage::intToSize(300)] 54 | ]; 55 | } 56 | 57 | /** 58 | * @param int $expected 59 | * @param int $actual 60 | * 61 | * @dataProvider providerTestIntToSize 62 | */ 63 | public function testIntToSize($expected, $actual) 64 | { 65 | $this->assertEquals($expected, $actual); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/include/URLTest.php: -------------------------------------------------------------------------------- 1 | . 19 | */ 20 | 21 | class URLTest extends \PHPUnit\Framework\TestCase 22 | { 23 | private static $valid_query_string = "second=value2&first=value&arr[0]=foo+bar&arr[1]=baz"; 24 | 25 | private static $valid_query_array = [ 26 | "second" => "value2", 27 | "first" => "value", 28 | "arr" => ["foo bar", "baz"] 29 | ]; 30 | 31 | public function testQueryStringToArray() 32 | { 33 | $valid_array = URL::queryStringToArray(static::$valid_query_string); 34 | $this->assertInternalType("array", $valid_array); 35 | $this->assertEquals(3, count($valid_array)); 36 | $this->assertArrayHasKey("second", $valid_array); 37 | $this->assertArrayHasKey("arr", $valid_array); 38 | $this->assertArrayHasKey("first", $valid_array); 39 | $this->assertInternalType("array", $valid_array["arr"]); 40 | $this->assertEquals(2, count($valid_array["arr"])); 41 | $this->assertEquals($valid_array, static::$valid_query_array); 42 | } 43 | 44 | public function testQueryArrayToString() 45 | { 46 | $valid_string = URL::queryArrayToString(static::$valid_query_array); 47 | $this->assertInternalType("string", $valid_string); 48 | $this->assertEquals(URL::decode($valid_string), URL::decode(static::$valid_query_string)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/include/UserTest.php: -------------------------------------------------------------------------------- 1 | 4 | * This file is part of stk-addons. 5 | * 6 | * stk-addons is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * stk-addons is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stk-addons. If not, see . 18 | */ 19 | 20 | class UserTest extends \PHPUnit\Framework\TestCase 21 | { 22 | 23 | /** 24 | * @return array 25 | */ 26 | public function providerTestUsernameValid() 27 | { 28 | return [ 29 | ["bob"], 30 | ["B.ob"], 31 | ["Test"], 32 | ["___"], 33 | ["..."], 34 | ["-_-"], 35 | ["007"], 36 | ["-007-"], 37 | [str_repeat("a", User::MAX_USERNAME)] // exactly 30 38 | ]; 39 | } 40 | 41 | /** 42 | * @param string $username 43 | * 44 | * @dataProvider providerTestUsernameValid 45 | */ 46 | public function testUsernameValid($username) 47 | { 48 | User::validateUserName($username); 49 | $this->addToAssertionCount(1); 50 | } 51 | 52 | 53 | /** 54 | * @return array 55 | */ 56 | public function providerTestUsernameThrowsException() 57 | { 58 | return [ 59 | ["S p a"], 60 | [""], 61 | ["|space"], 62 | ["__="], 63 | ["fff "], 64 | [" fff"], 65 | [str_repeat("a", User::MAX_USERNAME + 1)] 66 | ]; 67 | } 68 | 69 | /** 70 | * @param string $username 71 | * 72 | * @dataProvider providerTestUsernameThrowsException 73 | * @@expectedException UserException 74 | */ 75 | public function testUsernameThrowsException($username) 76 | { 77 | User::validateUserName($username); 78 | } 79 | 80 | 81 | /** 82 | * @return array 83 | */ 84 | public function providerTestUsernameValidWithSpace() 85 | { 86 | return [ 87 | ["Bob Bob"], 88 | ["0 0"], 89 | ["_ . . user name - "] 90 | ]; 91 | } 92 | 93 | /** 94 | * @dataProvider providerTestUsernameValidWithSpace 95 | */ 96 | public function testUsernameValidWithSpace($username) 97 | { 98 | User::validateUserName($username, true); 99 | $this->addToAssertionCount(1); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /tools/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all 2 | -------------------------------------------------------------------------------- /tools/dev-docker-run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #docker-compose -f docker-compose.yml -f docker-compose.dev.yml up 3 | docker-compose -f docker-compose.yml up 4 | -------------------------------------------------------------------------------- /tools/dev-precommit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ./vendor/bin/phpunit --configuration phpunit.xml 3 | composer phpcs 4 | composer phpstan 5 | -------------------------------------------------------------------------------- /tools/generate-ip-mappings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # usage: generate-ip-mappings.py 3 | # 2 files ipv4.csv and ipv6.csv will be generated 4 | # in mysql terminal: 5 | # 6 | # LOAD DATA LOCAL INFILE "`path to ipv4.csv`" INTO TABLE v3_ipv4_mapping COLUMNS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n'; 7 | # 8 | # For query by ip: 9 | # SELECT * FROM v3_ipv4_mapping WHERE `ip_start` <= ip-in-decimal AND `ip_end` >= ip-in-decimal ORDER BY `ip_start` DESC LIMIT 1; 10 | import socket 11 | import struct 12 | import csv 13 | import os 14 | import sys 15 | # import zipfile 16 | # import urllib.request 17 | 18 | def ip2int(addr): 19 | return struct.unpack("!I", socket.inet_aton(addr))[0] 20 | 21 | # Keep only the upper 64bit, as we only need that for geolocation 22 | def ipv62int64(addr): 23 | hi, lo = struct.unpack('!QQ', socket.inet_pton(socket.AF_INET6, addr)) 24 | return hi 25 | 26 | CSV_WEB_LINK = 'https://download.db-ip.com/free/dbip-city-lite-2020-01.csv.gz' 27 | CSV_FILE = 'dbip-city-lite-2020-01.csv' 28 | 29 | if not os.path.exists(CSV_FILE): 30 | print("File = {} does not exist. Download it from = {} ".format(CSV_FILE, CSV_WEB_LINK)) 31 | sys.exit(1) 32 | 33 | # Format: 1.0.0.0,1.0.0.255,OC,AU,Queensland,"South Brisbane",-27.4748,153.017 34 | with open(CSV_FILE, 'r') as csvfile, open('ipv4.csv', 'w') as ipv4, open('ipv6.csv', 'w') as ipv6: 35 | iplist = csv.reader(csvfile, delimiter=',', quotechar='"') 36 | for row in iplist: 37 | # Skip reserved range 38 | if row[3] == "ZZ": 39 | continue 40 | # Skip empty latitude and longitude 41 | if row[6] == "" or row[7] == "": 42 | continue 43 | 44 | if row[0].find(':') == -1: 45 | ipv4_line = True 46 | else: 47 | ipv4_line = False 48 | 49 | if ipv4_line: 50 | ip_start = ip2int(row[0]) 51 | ip_end = ip2int(row[1]) 52 | else: 53 | ip_start = ipv62int64(row[0]) 54 | ip_end = ipv62int64(row[1]) 55 | 56 | # Some IPv6 entries are duplicated after removing the lower 64bit 57 | if ip_start == ip_end: 58 | continue 59 | 60 | latitude = float(row[6]) 61 | longitude = float(row[7]) 62 | country = row[3] 63 | if ipv4_line: 64 | print('%d,%d,%f,%f,%s' % (ip_start, ip_end, latitude, longitude, country), file = ipv4) 65 | else: 66 | print('%d,%d,%f,%f,%s' % (ip_start, ip_end, latitude, longitude, country), file = ipv6) 67 | -------------------------------------------------------------------------------- /tools/generate-xml.php: -------------------------------------------------------------------------------- 1 | 4 | * 2015 - 2016 Daniel Butum 5 | * This file is part of stk-addons. 6 | * 7 | * stk-addons is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * stk-addons is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with stk-addons. If not, see . 19 | */ 20 | declare(strict_types=1); 21 | 22 | // Useful CLI interface for the addons 23 | if (php_sapi_name() !== "cli") 24 | exit("Not in CLI Mode"); 25 | 26 | require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php"); 27 | 28 | // Prevent against disaster!!! 29 | error_reporting(E_ALL); 30 | ini_set('display_errors', "On"); 31 | ini_set('html_errors', "Off"); 32 | 33 | 34 | $xml = writeNewsXML(); 35 | echo 'News xml written: ' . $xml . ' bytes' . PHP_EOL; 36 | 37 | $xml = writeAssetXML(); 38 | echo 'Asset xml written: ' . $xml . ' bytes' . PHP_EOL; 39 | -------------------------------------------------------------------------------- /tools/get-achievements.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php -q 2 | 5 | * 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | // Script that takes an XML file with all the achievements and generates a SQL insert command 22 | if (php_sapi_name() !== "cli") exit("Not in CLI Mode"); 23 | 24 | # validate data 25 | if ($argc < 2) exit(sprintf("Usage: php %s " . PHP_EOL, $argv[0])); 26 | $filename = $argv[1]; 27 | if (!file_exists($filename)) exit(sprintf("File '%s' does not exist" . PHP_EOL, $filename)); 28 | 29 | $dom = new DOMDocument(); 30 | $dom->load($filename); 31 | $achievements = $dom->getElementsByTagName("achievement"); 32 | 33 | echo "INSERT INTO `v3_achievements` (`id`, `name`) VALUES" . PHP_EOL; 34 | foreach ($achievements as $i => $achievement) 35 | { 36 | /** @var DOMElement $achievement */ 37 | echo sprintf( 38 | " (%s, '%s')%s" . PHP_EOL, 39 | $achievement->getAttribute("id"), 40 | str_replace("'", "''", $achievement->getAttribute("name")), 41 | $i == ($achievements->length - 1) ? ';' : ',' 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /tools/production-install-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ./production-install-composer.sh 3 | ./production-install-yarn.sh 4 | -------------------------------------------------------------------------------- /tools/production-install-composer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | composer install --no-dev --optimize-autoloader -------------------------------------------------------------------------------- /tools/production-install-yarn.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | yarn install --production -------------------------------------------------------------------------------- /tools/production-update-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ./production-update-composer.sh 3 | ./production-update-yarn.sh 4 | -------------------------------------------------------------------------------- /tools/production-update-composer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | composer update --no-dev --optimize-autoloader -------------------------------------------------------------------------------- /tools/production-update-yarn.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | yarn install --production 3 | -------------------------------------------------------------------------------- /tpl/default/about.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 |

{t}About STK Add-Ons{/t}

4 |

SuperTuxKart

5 |

{t}SuperTuxKart is a Free 3D kart racing game, with many tracks, characters and items for you to try.{/t}

6 |

{t}Since version 0.7.1, SuperTuxKart has had the ability to fetch important messages from the STKAddons website. Since 0.7.2, the game has included a built-in add-on manager.{/t}

7 |

{t 1='50' 2='60' 3='15'}SuperTuxKart now has over %1 karts, %2 tracks, and %3 arenas available in-game thanks to the add-on service.{/t}

8 |

{t}Of course, the artists who create all of this content must be thanked too. Without them, the add-on website would not be as great as it is today.{/t}

9 |

10 | {t}Website{/t} | {t}Donate{/t} 11 |

12 | 13 |

{t}Credits{/t}

14 |
{$about.credits.content}
15 |
16 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/addons/index.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 |
4 |
5 |
6 |
7 | 8 | 12 | 16 |
17 |
18 |
19 | 24 | 25 | 26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {$addon.menu} 34 |
35 |
36 |
37 | {$addon.status} 38 |
39 | 40 |
41 | {if $is_name && empty($addon.body)} 42 |
43 |
44 | {t}The addon name does not exist{/t} 45 |
46 | {else} 47 | {$addon.body} 48 | {/if} 49 |
50 |
51 |
52 |
53 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/addons/menu.tpl: -------------------------------------------------------------------------------- 1 | {if empty($addons)} 2 |

{t}No addons{/t}

3 | {else} 4 | 16 | {/if} 17 | {$pagination} -------------------------------------------------------------------------------- /tpl/default/addons/rating.tpl: -------------------------------------------------------------------------------- 1 | {$checked_1=""} {$checked_2=""} {$checked_3=""} 2 | {if $rating_1} 3 | {$checked_1=" checked"} 4 | {/if} 5 | {if $rating_2} 6 | {$checked_2=" checked"} 7 | {/if} 8 | {if $rating_3} 9 | {$checked_3=" checked"} 10 | {/if} 11 | 12 | 13 | 14 |
{*1 star*} 20 | 21 |
{*2 stars*} 27 | 28 | {*3 stars*} 34 |
-------------------------------------------------------------------------------- /tpl/default/bugs/add.tpl: -------------------------------------------------------------------------------- 1 | {if $bug} 2 |

{t}File a bug{/t}

3 |
4 |
8 |
9 | 12 |
13 | 16 |
17 |
18 |
19 | 22 |
23 | 31 |
32 |
33 |
34 |
37 |
38 | 42 |
43 |
44 |
45 |
46 | 47 | 48 |
49 |
50 |
51 | {else} 52 |
53 | {t}Warning!{/t} {t}You must be {/t}{t}logged in{/t} 54 |
55 | {/if} 56 | -------------------------------------------------------------------------------- /tpl/default/bugs/all.tpl: -------------------------------------------------------------------------------- 1 | {if empty($bugs.items)} 2 |
3 | {t}Empty!{/t} {t}There are no bugs :){/t} 4 |
5 | {else} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | {foreach $bugs.items as $item} 18 | 19 | 20 | 21 | 22 | 29 | 30 | 31 | {/foreach} 32 | 33 |
ID{t}Addon{/t}{t}Title{/t}{t}Status{/t}{t}Changed{/t}
{$item.id}{$item.addon_id}{$item.title|truncate:42} 23 | {if $item.close_id} 24 | {t}closed{/t} 25 | {else} 26 | {t}open{/t} 27 | {/if} 28 | {$item.date_edit}
34 | {/if} -------------------------------------------------------------------------------- /tpl/default/bugs/index.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 |

{t}Bug Tracker{/t} 4 | {t}for addons{/t} 5 |

6 |
7 |
8 |
9 |
10 |
11 | 13 |
14 |
15 | 20 |
21 |
22 | 25 |
26 | 27 |
28 |
29 |
30 | {if !empty($bugs.show_btn_file) && $bugs.show_btn_file == true} 31 | {$btn_file_hide=""} 32 | {$btn_back_hide=" hidden"} 33 | {else} 34 | {$btn_file_hide=" hidden"} 35 | {$btn_back_hide=""} 36 | {/if} 37 | 38 | 41 | 44 |
45 |
46 |

47 |
48 | {$bugs.content} 49 |
50 |
51 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/bugs/view-comment.tpl: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{$comment.user_name} 4 |
5 | {if isset($can_edit_comment) && $can_edit_comment} 6 |
7 | {$comment.date} 8 | 12 | 16 |
17 | {else} 18 | {$comment.date} 19 | {/if} 20 |
21 |

22 |
23 |
24 | {$comment.description} 25 |
26 |
-------------------------------------------------------------------------------- /tpl/default/error-page.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 |
4 |

Oops! Error Happened!

5 |
6 | 7 | Sad Tux 8 |
9 |
10 |

{$error.title}

11 |

{$error.message}

12 |
13 |
14 |
{* #error-container *} 15 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/feedback/all.tpl: -------------------------------------------------------------------------------- 1 | {include file="./errors.tpl"} 2 | {include file="./warnings.tpl"} 3 | {include file="./success.tpl"} -------------------------------------------------------------------------------- /tpl/default/feedback/errors.tpl: -------------------------------------------------------------------------------- 1 | {if $errors|default:''|count_characters != 0} 2 |
3 | {$errors} 4 |
5 | {/if} -------------------------------------------------------------------------------- /tpl/default/feedback/success.tpl: -------------------------------------------------------------------------------- 1 | {if $success|default:''|count_characters != 0} 2 |
3 | {$success} 4 |
5 | {/if} -------------------------------------------------------------------------------- /tpl/default/feedback/warnings.tpl: -------------------------------------------------------------------------------- 1 | {if $warnings|default:''|count_characters != 0} 2 |
3 | {$warnings} 4 |
5 | {/if} -------------------------------------------------------------------------------- /tpl/default/footer.tpl: -------------------------------------------------------------------------------- 1 | {* content-wrapper *} 2 | 6 | {* #body-wrapper *} 7 | {foreach $script_inline.before as $script} 8 | 9 | {/foreach} 10 | {foreach $script_includes as $script} 11 | {if isset($script.ie) && $script.ie} 12 | 13 | {else} 14 | 15 | {/if} 16 | {/foreach} 17 | {foreach $script_inline.after as $script} 18 | 19 | {/foreach} 20 | {$debug_toolbar.footer} 21 | 22 | 23 | -------------------------------------------------------------------------------- /tpl/default/header.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {$title|default:"SuperTuxKart Add-ons"} 5 | 6 | {* Set character encoding for the document *} 7 | 8 | {foreach $meta_tags as $meta_field => $meta_content} 9 | 10 | {/foreach} 11 | 12 | {* Instruct Internet Explorer to use its latest rendering engine *} 13 | 14 | 15 | 16 | {foreach $css_includes as $css} 17 | {if empty($css.media)} 18 | 19 | {else} 20 | 21 | {/if} 22 | {/foreach} 23 | 24 | {* Favicon *} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | {$debug_toolbar.header} 43 | 44 | 45 |
46 | {include file="./menu-top.tpl"} 47 |
-------------------------------------------------------------------------------- /tpl/default/index.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 | 4 | 5 |
6 | {foreach $index_menu as $index} 7 | 13 | {/foreach} 14 |
{* #index-menu *} 15 |
16 | 23 |
24 |
{* #index-body *} 25 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/maintenance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Down For Maintenance 5 | 6 | 17 | 18 | 19 |

Down For Maintenance

20 | 21 |

Sorry for the inconvenience, but we’re performing a maintenance at the moment.

22 | 23 |

We’ll be back online shortly!

24 |

Updates:

25 |
    26 |
  1. IRC #supertuxkart on Freenode
  2. 27 |
  3. Twitter @supertuxkart
  4. 28 |
29 | 30 | -------------------------------------------------------------------------------- /tpl/default/manage/page/cache.tpl: -------------------------------------------------------------------------------- 1 |

{t}Cache Files{/t}


2 |
{t}Empty cache{/t}
-------------------------------------------------------------------------------- /tpl/default/manage/page/clients.tpl: -------------------------------------------------------------------------------- 1 |

{t}Client Versions{/t}

2 |

{t}Clients by User-Agent{/t}

3 | 4 | {if empty($clients.items)} 5 |
6 |
{t}There are currently no SuperTuxKart clients recorded. Your download script may not be configured properly.{/t}
7 | {else} 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {foreach $clients.items as $item} 19 | 20 | 21 | 22 | 23 | {/foreach} 24 | 25 |
{t}User-Agent String{/t}{t}Game Version{/t}
{$item.agent_string}{$item.stk_version}
26 |
27 |
28 | {/if} -------------------------------------------------------------------------------- /tpl/default/manage/page/files.tpl: -------------------------------------------------------------------------------- 1 |

{t}Uploaded Files{/t}

2 | {if empty($upload.items)} 3 |
{t}No files have been uploaded.{/t}
4 | {else} 5 |
6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {$last_id=null} 17 | {foreach $upload.items as $item} 18 | {if $last_id !== $item.addon_id} 19 | {if !$item.addon_id} 20 | 21 | 22 | 23 | 24 | {else} 25 | 26 | 27 | 28 | 29 | {/if} 30 | {/if} 31 | 32 | 33 | 34 | 35 | 48 | 49 | {$last_id=$item.addon_id} 50 | {/foreach} 51 | 52 |
{t}Name{/t}{t}Type{/t}{t}References{/t}
{t}Unassociated{/t}
{$item.addon_id} ({$item.addon_type})
{$item.path}{$item.type_string} 36 | {if $item.type} 37 | {if !$item.exists} 38 | {t}File not found on filesystem{/t} 39 | {/if} 40 | {if empty($item.references)} 41 | {t}None{/t} 42 | {/if} 43 | {$item.references} 44 | {else} 45 | {t}No record found in database{/t} 46 | {/if} 47 |
53 |
54 |
55 | {/if} -------------------------------------------------------------------------------- /tpl/default/manage/page/logs.tpl: -------------------------------------------------------------------------------- 1 |

{t}Event Logs{/t}

2 |

{t}The table below lists the most recent logged events.{/t}

3 | 4 | {if empty($logs.items)} 5 |
{t}No events have been logged yet.{/t}
6 | {else} 7 |
8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {foreach $logs.items as $item} 19 | 20 | 21 | 22 | 23 | 24 | {/foreach} 25 | 26 |
{t}Date{/t}{t}Username{/t}{t}Description{/t}
{$item.date}{$item.username}{$item.message}
27 |
28 |
29 | {/if} -------------------------------------------------------------------------------- /tpl/default/manage/page/news.tpl: -------------------------------------------------------------------------------- 1 |

{t}News Messages{/t}


2 |
3 |
4 |
5 | 8 |
9 | 10 |
11 |
12 |
13 | 16 |
17 | 18 |
19 |
20 |
21 | 24 |
25 | 26 |
27 |
28 |
29 | 32 |
33 | 34 |
35 |
36 |
37 |
38 | 39 | 40 |
41 |
42 |

43 |
44 |
45 |
46 | {if empty($news.items)} 47 |

{t}No news messages currently exist.{/t}

48 | {else} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {foreach $news.items as $item} 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | {/foreach} 72 |
{t}Date{/t}{t}Message{/t}{t}Author{/t}{t}Condition{/t}{t}Display on web page{/t}{t}Is Important{/t}{t}Actions{/t}
{$item.date}{$item.content}{$item.author}{$item.condition}{$item.is_web_display}{$item.is_important} 68 | 69 |
73 | {/if} 74 |
75 |
76 | -------------------------------------------------------------------------------- /tpl/default/manage/page/overview.tpl: -------------------------------------------------------------------------------- 1 |

{t}Overview{/t}

2 |

{t}Unapproved Add-Ons{/t}

3 |

{t}Note that only add-ons where the newest revision is unapproved will appear here.{/t}

4 | {if !empty($overview.addons)} 5 | {foreach $overview.addons as $addon} 6 | {$addon.name}
7 | {t}Revisions:{/t} {$addon.unapproved} 8 |

9 | {/foreach} 10 | {else} 11 |

{t}No unapproved add-ons.{/t}


12 | {/if} 13 | 14 |

{t}Unapproved Files{/t}

15 |

{t}Images:{/t}

16 | {if !empty($overview.images)} 17 | {foreach $overview.images as $image} 18 | {$image.name}
19 | {t}Images:{/t} {$image.unapproved} 20 |

21 | {/foreach} 22 | {else} 23 |

{t}No unapproved images.{/t}


24 | {/if} 25 | 26 |

{t}Source Archives:{/t}

27 | {if !empty($overview.archives)} 28 | {foreach $overview.archives as $archive} 29 | {$archive.name}
30 | {*{t count=$archive.unapproved|@count plural="%1 Files"}%1 File{/t}*} 31 | {$archive.unapproved} Files 32 |

33 | {/foreach} 34 | {else} 35 |

{t}No unapproved source archives.{/t}


36 | {/if} 37 | 38 | 39 | -------------------------------------------------------------------------------- /tpl/default/manage/page/roles.tpl: -------------------------------------------------------------------------------- 1 |

{t}Manage Roles{/t}

2 |
3 |
4 |
5 |

Roles

6 |
7 | {foreach $roles.roles as $role} 8 | 9 | {/foreach} 10 |
11 |
12 |
13 | 14 | 15 |
16 |
17 |
18 | 19 | 20 |
21 |
22 |
23 | 24 |
25 |
26 |
27 |

Permissions

28 |
29 |
30 | {foreach $roles.permissions as $permission} 31 |
32 | 35 |
36 | {/foreach} 37 |
38 |
39 | 40 | 41 | 42 |
43 |
44 |
45 |
46 |
47 |
-------------------------------------------------------------------------------- /tpl/default/menu-lang.tpl: -------------------------------------------------------------------------------- 1 | {$lang.label} 2 | 8 | -------------------------------------------------------------------------------- /tpl/default/menu-top.tpl: -------------------------------------------------------------------------------- 1 |
2 | 59 |
60 | -------------------------------------------------------------------------------- /tpl/default/music-browser.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
3 |

{t}Browse Music{/t}

4 | {html_table loop=$music_browser.data cols=$music_browser.cols table_attr='border="0"'} 5 |
6 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/pagination/inner-for.tpl: -------------------------------------------------------------------------------- 1 | {if $i === $pagination.current_page} 2 |
  • {$i}
  • 3 | {else} 4 |
  • {$i}
  • 5 | {/if} -------------------------------------------------------------------------------- /tpl/default/pagination/template.tpl: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | 9 |
    10 | {if $pagination.has_pagination} 11 |
    12 |
      13 | {$prev_class=""} {$first_class=""} {$prev_href="#"} 14 | {if $pagination.prev_page} 15 | {$prev_href=$pagination.prev_page} 16 | {else} 17 | {$prev_class=" class=\"disabled\""} 18 | {$first_class=" class=\"active\""} 19 | {/if} 20 | {$next_class=""} {$last_class=""} {$next_href="#"} 21 | {if $pagination.next_page} 22 | {$next_href=$pagination.next_page} 23 | {else} 24 | {$next_class=" class=\"disabled\""} 25 | {$last_class=" class=\"active\""} 26 | {/if} 27 | 28 | « 29 | 1 30 | {if $pagination.nr_buttons + 3 > $pagination.total_pages} 31 | {*just display the buttons normally*} 32 | {for $i=2 to $pagination.total_pages - 1} 33 | {include file="./inner-for.tpl" scope="parent"} 34 | {/for} 35 | {else} 36 | {*calculate where we are and build buttons*} 37 | {if $pagination.build_left && $pagination.build_right} 38 | {*build both sides*} 39 | {$nr_buttons = floor($pagination.nr_buttons/2)} 40 | 41 |
    • ...
    • 42 | {for $i = $pagination.current_page - $nr_buttons to $pagination.current_page - 1} 43 |
    • {$i}
    • 44 | {/for} 45 |
    • {$pagination.current_page}
    • 46 | {for $i = $pagination.current_page + 1 to $pagination.current_page + $nr_buttons} 47 |
    • {$i}
    • 48 | {/for} 49 |
    • ...
    • 50 | {else} 51 | {*build one side*} 52 | {if $pagination.build_left} 53 |
    • ...
    • 54 | {else} 55 | {for $i = 2 to $pagination.nr_buttons + 2} 56 | {include file="./inner-for.tpl" scope="parent"} 57 | {/for} 58 | {/if} 59 | 60 | {if $pagination.build_right} 61 |
    • ...
    • 62 | {else} 63 | {for $i = ($pagination.total_pages - $pagination.nr_buttons) to $pagination.total_pages - 1} 64 | {include file="./inner-for.tpl" scope="parent"} 65 | {/for} 66 | {/if} 67 | {/if} 68 | {/if} 69 | {$pagination.total_pages} 70 | » 71 |
    72 |
    73 | {/if} 74 |
    75 | -------------------------------------------------------------------------------- /tpl/default/password-reset.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
    3 |

    {t}Reset Password{/t}

    4 | {include file="feedback/all.tpl"} 5 | {if $pass_reset.reset_form.display == true} 6 |
    7 |
    8 | {t}In order to reset your password, please enter your username and your email address. A password reset link will be emailed to you. Your old password will become inactive until your password is reset.{/t} 9 |
    10 |
    11 | 12 |
    13 | 14 |
    15 |
    16 |
    17 | 18 |
    19 | 20 |
    21 |
    22 |
    23 |
    24 |
    25 |
    26 |
    27 |
    28 |
    29 | 30 |
    31 |
    32 |
    33 | {/if} 34 | {if $pass_reset.pass_form.display == true} 35 |
    36 |
    37 | {t}Please enter a new password for your account.{/t} 38 |
    39 |
    40 | 46 |
    47 | 48 |
    49 |
    50 |
    51 | 52 |
    53 | 54 |
    55 |
    56 |
    57 |
    58 | 59 | 60 | 61 |
    62 |
    63 |
    64 | {/if} 65 |
    66 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/rankings.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 | 3 |
    4 |

    {t}Rankings{/t}

    5 |
    6 | 7 | {foreach $player_rankings.sections as $section} 8 | {$section} 9 | {/foreach} 10 | 11 |
    12 |

    Play ranked servers to have your name in the list!

    13 |

    Visit here for details about player rankings.

    14 |
    15 | {include file=$tpl_config.footer} 16 | -------------------------------------------------------------------------------- /tpl/default/stats/chart.tpl: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |

    4 | {$chart.title} 5 |

    6 | {if $chart.show_buttons} 7 |
    8 |
    9 | 12 | 15 | 18 |
    19 |
    20 | {/if} 21 |
    22 |
    23 |
    24 |
    25 |
    -------------------------------------------------------------------------------- /tpl/default/stats/index.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
    3 |

    {t}Statistics{/t} 4 | {$stats.online} online user{if $stats.online != 1}s{/if} 5 |

    6 |
    7 | {$stats.body} 8 |
    9 |
    10 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/stats/page/addons.tpl: -------------------------------------------------------------------------------- 1 | {foreach $addons.sections as $section} 2 | {$section} 3 | {/foreach} -------------------------------------------------------------------------------- /tpl/default/stats/page/clients.tpl: -------------------------------------------------------------------------------- 1 | {foreach $clients.sections as $section} 2 | {$section} 3 | {/foreach} -------------------------------------------------------------------------------- /tpl/default/stats/page/files.tpl: -------------------------------------------------------------------------------- 1 | {foreach $files.sections as $section} 2 | {$section} 3 | {/foreach} -------------------------------------------------------------------------------- /tpl/default/stats/page/overview.tpl: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 |

    {t}Addons{/t}

    6 |
    7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    13 |
    14 | 21 |
    22 |
    23 |
    24 |
    25 |
    26 |
    27 |
    28 |
    29 |
    30 |
    31 |

    {t}Clients{/t}

    32 |
    33 |
    34 |
    35 |
    36 |
    37 |
    38 | {*
    *} 39 | {*
    *} 40 | {*
    *} 41 | {*

    {t}Servers{/t}

    *} 42 | {*
    *} 43 | {*
    *} 44 | {*
    *} 45 | {*
    *} 46 | {*
    *} 47 | {*
    *} 48 |
    -------------------------------------------------------------------------------- /tpl/default/stats/page/servers.tpl: -------------------------------------------------------------------------------- 1 | {foreach $servers.sections as $section} 2 | {$section} 3 | {/foreach} -------------------------------------------------------------------------------- /tpl/default/stats/section.tpl: -------------------------------------------------------------------------------- 1 | {if !empty($section.data)} 2 |

    {$section.title}

    3 |
    4 |

    5 | {$section.description} 6 |

    7 | 8 | 9 | 10 | {foreach $section.columns as $column} 11 | 12 | {/foreach} 13 | 14 | 15 | 16 | {foreach $section.data as $row} 17 | 18 | {foreach $section.columns as $column} 19 | 20 | {/foreach} 21 | 22 | {/foreach} 23 | 24 |
    {$column}
    {$row.$column}
    25 |
    26 | {/if} -------------------------------------------------------------------------------- /tpl/default/users/index.tpl: -------------------------------------------------------------------------------- 1 | {include file=$tpl_config.header} 2 |
    3 |
    4 |
    5 |
    6 |
    7 | 8 | 9 |
    10 |
    11 |
    12 |
    13 |
    14 |
    15 | {$user.menu} 16 |
    17 |
    18 |
    19 | {$user.body} 20 |
    21 |
    22 |
    23 |
    24 | {include file=$tpl_config.footer} -------------------------------------------------------------------------------- /tpl/default/users/menu.tpl: -------------------------------------------------------------------------------- 1 | {if empty($users)} 2 |

    {t}No users match your search{/t}

    3 | {else} 4 |
    5 | {foreach $users as $user} 6 | 7 | 8 | {$user.username|truncate:28} 9 | 10 | {/foreach} 11 |
    12 | {/if} 13 | {$pagination} -------------------------------------------------------------------------------- /tpl/default/users/panel.tpl: -------------------------------------------------------------------------------- 1 | 9 |
    10 | {include file="./tab/profile.tpl" scope="parent"} 11 | {include file="./tab/friends.tpl" scope="parent"} 12 | {include file="./tab/achievements.tpl" scope="parent"} 13 | {if $can_see_settings} 14 | {include file="./tab/settings.tpl" scope="parent"} 15 | {/if} 16 |
    -------------------------------------------------------------------------------- /tpl/default/users/tab/achievements.tpl: -------------------------------------------------------------------------------- 1 |

    2 | {if empty($user.achievements)} 3 |
    4 | {t}Empty!{/t} {t}There are no achievements :({/t} 5 |
    6 | {else} 7 | 8 | 9 | 10 | 11 | 12 | {foreach $user.achievements as $achievement} 13 | 14 | 15 | 16 | 17 | {/foreach} 18 |
    #ID{t}Name{/t}
    {$achievement.id}{$achievement.name}
    19 | {/if} 20 |
    -------------------------------------------------------------------------------- /tpl/default/users/tab/friends.tpl: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | {if empty($user.friends)} 4 |
    5 | {t}Empty!{/t} {t}There are no friends :({/t} 6 |
    7 | {else} 8 | 9 | 10 | 11 | 12 | 13 | {if $is_owner} 14 | 15 | 16 | {/if} 17 | 18 | 19 | 20 | {if $is_owner} 21 | {foreach $user.friends as $friend} 22 | {$class=""} 23 | {$is_pending=$friend->isPending()} 24 | {$is_asker=$friend->isAsker()} 25 | {if $is_pending} 26 | {$class=" class=\"danger\""} 27 | {/if} 28 | 29 | 30 | 31 | 38 | 56 | 57 | {/foreach} 58 | {else} 59 | {foreach $user.friends as $friend} 60 | 61 | 62 | 63 | 64 | {/foreach} 65 | {/if} 66 | 67 |
    {t}Username{/t}{t}Since{/t}{t}Status{/t}{t}Actions{/t}
    {$friend->getUser()->getUsername()}{$friend->getDate()} 32 | {if $is_pending} 33 | {t}Pending{/t} 34 | {else} 35 | {t}Offline{/t} 36 | {/if} 37 | 39 |
    40 | {$class_accept=" hidden"} {$class_decline=" hidden"} {$class_cancel=" hidden"} {$class_remove=" hidden"} 41 | {if $is_pending} 42 | {if $is_asker} 43 | {$class_accept=""} {$class_decline=""} 44 | {else} 45 | {$class_cancel=""} 46 | {/if} 47 | {else} 48 | {$class_remove=""} 49 | {/if} 50 | 51 | 52 | 53 | 54 |
    55 |
    {$friend->getUser()->getUsername()}{$friend->getDate()}
    68 | 69 | {/if} 70 |
    -------------------------------------------------------------------------------- /users-menu.php: -------------------------------------------------------------------------------- 1 | 4 | * 2012-2014 Stephen Just 5 | * 2014-2015 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | AccessControl::setLevel(AccessControl::PERM_VIEW_BASIC_PAGE); 23 | 24 | $has_permission = User::hasPermission(AccessControl::PERM_EDIT_USERS); 25 | $current_page = PaginationTemplate::getPageNumber(); 26 | $limit = PaginationTemplate::getLimitNumber(); 27 | 28 | 29 | // get all users from the database, create links, if the user has permission get all the users, not only the active ones 30 | $users = User::getAll(!$has_permission, $limit, $current_page); 31 | $template_users = User::filterMenuTemplate($users, empty($_GET["user"]) ? User::getLoggedUserName() : $_GET["user"]); 32 | 33 | $pagination = PaginationTemplate::get() 34 | ->setItemsPerPage($limit) 35 | ->setTotalItems(User::count(!$has_permission)) 36 | ->setCurrentPage($current_page) 37 | ->setNumberButtons(3); 38 | 39 | $tpl = StkTemplate::get("users/menu.tpl") 40 | ->assign("img_location", IMG_LOCATION) 41 | ->assign("users", $template_users) 42 | ->assign("pagination", $pagination->toString()); 43 | 44 | echo $tpl; 45 | -------------------------------------------------------------------------------- /users.php: -------------------------------------------------------------------------------- 1 | 4 | * 2012-2014 Stephen Just 5 | * 2014 Daniel Butum 6 | * This file is part of stk-addons. 7 | * 8 | * stk-addons is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * stk-addons is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with stk-addons. If not, see . 20 | */ 21 | require_once(__DIR__ . DIRECTORY_SEPARATOR . "config.php"); 22 | AccessControl::setLevel(AccessControl::PERM_VIEW_BASIC_PAGE); 23 | 24 | // set current user if not defined 25 | $_GET['user'] = (isset($_GET['user'])) ? $_GET['user'] : User::getLoggedUserName(); 26 | 27 | $tpl = StkTemplate::get('users/index.tpl') 28 | ->assignTitle(_h('Users')) 29 | ->addUtilLibrary() 30 | ->addScriptInclude("user.js"); 31 | 32 | $tpl_data = [ 33 | "body" => Util::ob_get_require_once(ROOT_PATH . "users-panel.php"), 34 | "menu" => Util::ob_get_require_once(ROOT_PATH . "users-menu.php") 35 | ]; 36 | 37 | // output the view 38 | $tpl->assign("user", $tpl_data); 39 | echo $tpl; 40 | --------------------------------------------------------------------------------