Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-27824 - course category: add check test for ->coursesperpage value.

  • Loading branch information...
commit eabdc81c403d41babcb653b673f352a04750161e 1 parent d402e05
rwijaya rwijaya authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 course/category.php
10 course/category.php
View
@@ -31,7 +31,6 @@
$id = required_param('id', PARAM_INT); // Category id
$page = optional_param('page', 0, PARAM_INT); // which page to show
-$perpage = optional_param('perpage', $CFG->coursesperpage, PARAM_INT); // how many per page
$categoryedit = optional_param('categoryedit', -1, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
@@ -41,6 +40,15 @@
$resort = optional_param('resort', 0, PARAM_BOOL);
$sesskey = optional_param('sesskey', '', PARAM_RAW);
+// MDL-27824 - This is a temporary fix until we have the proper
+// way to check/initialize $CFG value.
+if (isset($CFG->coursesperpage)) {
+ $defaultperpage = $CFG->coursesperpage;
+} else {
+ $defaultperpage = 20;
+}
+$perpage = optional_param('perpage', $defaultperpage, PARAM_INT); // how many per page
+
if (empty($id)) {
print_error("unknowcategory");
}
Please sign in to comment.
Something went wrong with that request. Please try again.