moodle-an-hochschulen / moodle-local_staticpage

Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
GNU General Public License v3.0
46 stars 28 forks source link

Bug if apache-rewrite and moodle is subdirectory. #31

Closed vel21ripn closed 6 years ago

vel21ripn commented 6 years ago

I'm use $CFG->wwwroot = "http://moodle.local/new" and enabled "apacherewrite".

php receives a request from server with REQUEST_URI = "/new/static/...."

Wrong code in view.php:49

if (strpos($_SERVER['REQUEST_URI'], '/static/') > 0 || strpos($_SERVER['REQUEST_URI'], '/static/') === false) {
        die;
}

Maybe it makes sense to just check

if (strpos($_SERVER['REQUEST_URI'], '/static/') === false) {
   die;
}
abias commented 6 years ago

Hi @vel21ripn ,

thank you for this note. You are absolutely right, this check was too strict for subdirectory installations. I fixed this a proposed in https://github.com/moodleuulm/moodle-local_staticpage/commit/5d5e0978b3e6a7e86c125237c8fe9a115cd7d1e5.

Cheers, Alex