blog MDL-23393 - Tidy up preferences form
[moodle.git] / blog / preferences_form.php
index 4d94ec9..d5c5005 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+if (!defined('MOODLE_INTERNAL')) {
+    die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
+}
+
 require_once($CFG->libdir.'/formslib.php');
 
 class blog_preferences_form extends moodleform {
@@ -35,7 +39,9 @@ class blog_preferences_form extends moodleform {
         $strpagesize = get_string('pagesize', 'blog');
 
         $mform->addElement('text', 'pagesize', $strpagesize);
-        $mform->setDefault('pagesize', get_user_preferences('pagesize'));
+        $mform->setType('pagesize', PARAM_INT);
+        $mform->addRule('pagesize', null, 'numeric', null, 'client');
+        $mform->setDefault('pagesize', 10);
 
         $this->add_action_buttons();
     }