From 4d933beb8a06d8e076f46ef3994d758454fb766f Mon Sep 17 00:00:00 2001 From: Jonathan Newman Date: Tue, 20 Jan 2009 23:53:34 +0000 Subject: [PATCH] cvsimport fixups --- admin/mnet/mnet_themes.html | 2 +- admin/pagelib.php | 10 +- admin/search.php | 4 +- admin/settings.php | 6 +- admin/upgradesettings.php | 4 +- .../admin_bookmarks/block_admin_bookmarks.php | 6 +- blocks/admin_bookmarks/create.php | 8 +- blocks/admin_bookmarks/delete.php | 6 +- blocks/admin_tree/block_admin_tree.php | 8 +- blocks/moodleblock.class.php | 2 +- blocks/rss_client/block_rss_client.php | 4 +- blocks/rss_client/config_instance.html | 2 +- blocks/rss_client/config_instance_tabs.php | 4 +- course/category.php | 2 +- course/delete.php | 2 +- course/import/groups/index.php | 6 +- grade/import/grade_import_form.php | 23 ++ lang/en_utf8/qtype_randomsamatch.php | 5 +- lang/en_utf8/qtype_shortanswer.php | 5 +- mod/feedback/analysis.php | 2 +- mod/feedback/analysis_course.php | 4 +- mod/feedback/complete.php | 4 +- mod/lesson/action/confirmdelete.php | 2 +- mod/quiz/settingslib.php | 10 +- question/type/missingtype/questiontype.php | 2 +- repository/boxnet/class.curl.php | 358 ------------------ .../flickr/PEAR/HTTP/Request/Listener.php | 106 ------ 27 files changed, 81 insertions(+), 516 deletions(-) delete mode 100755 repository/boxnet/class.curl.php delete mode 100755 repository/flickr/PEAR/HTTP/Request/Listener.php diff --git a/admin/mnet/mnet_themes.html b/admin/mnet/mnet_themes.html index 054e140271..2e1c4a2e3a 100644 --- a/admin/mnet/mnet_themes.html +++ b/admin/mnet/mnet_themes.html @@ -18,7 +18,7 @@ if ($mnet_peer->id != $CFG->mnet_all_hosts_id) { print_tabs(array($tabs), 'mnetthemes'); $themes = get_list_of_plugins("theme"); - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; + $sesskey = sesskey(); echo ''; diff --git a/admin/pagelib.php b/admin/pagelib.php index 1dee158b54..7bcff27be3 100644 --- a/admin/pagelib.php +++ b/admin/pagelib.php @@ -36,11 +36,11 @@ class page_admin extends page_base { return; } - $adminroot =& admin_get_root(false, false); //settings not required - only pages + $adminroot = admin_get_root(false, false); //settings not required - only pages // fetch the path parameter $this->section = $section; - $current =& $adminroot->locate($section, true); + $current = $adminroot->locate($section, true); $this->visiblepathtosection = array_reverse($current->visiblepath); // all done @@ -69,10 +69,10 @@ class page_admin extends page_base { return $this->url; } - $adminroot =& admin_get_root(false, false); //settings not required - only pages + $adminroot = admin_get_root(false, false); //settings not required - only pages - $root =& $adminroot->locate($this->section); - if (is_a($root, 'admin_externalpage')) { + $root = $adminroot->locate($this->section); + if ($root instanceof admin_externalpage) { return $root->url; } else { return ($CFG->wwwroot . '/' . $CFG->admin . '/settings.php'); diff --git a/admin/search.php b/admin/search.php index f3b5557522..2d13ba56ba 100644 --- a/admin/search.php +++ b/admin/search.php @@ -7,7 +7,7 @@ require_once($CFG->libdir.'/adminlib.php'); $query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string -$adminroot =& admin_get_root(); // need all settings here +$adminroot = admin_get_root(); // need all settings here $adminroot->search = $query; // So we can reference it in search boxes later in this invocation $statusmsg = ''; $errormsg = ''; @@ -20,7 +20,7 @@ if ($data = data_submitted() and confirm_sesskey()) { if (admin_write_settings($data)) { $statusmsg = get_string('changessaved'); } - $adminroot =& admin_get_root(true); //reload tree + $adminroot = admin_get_root(true); //reload tree if (!empty($adminroot->errors)) { $errormsg = get_string('errorwithsettings', 'admin'); diff --git a/admin/settings.php b/admin/settings.php index 2cdef063f0..cc39b20956 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -12,10 +12,10 @@ $adminediting = optional_param('adminedit', -1, PARAM_BOOL); /// no guest autologin require_login(0, false); -$adminroot =& admin_get_root(); // need all settings -$page =& $adminroot->locate($section); +$adminroot = admin_get_root(); // need all settings +$page = $adminroot->locate($section); -if (empty($page) or !is_a($page, 'admin_settingpage')) { +if (empty($page) or !($page instanceof admin_settingpage)) { print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/"); die; } diff --git a/admin/upgradesettings.php b/admin/upgradesettings.php index d5973418d1..81f5cdd11f 100644 --- a/admin/upgradesettings.php +++ b/admin/upgradesettings.php @@ -11,13 +11,13 @@ $return = optional_param('return', '', PARAM_ALPHA); /// no guest autologin require_login(0, false); -$adminroot =& admin_get_root(); // need all settings +$adminroot = admin_get_root(); // need all settings admin_externalpage_setup('upgradesettings'); // now hidden page // now we'll deal with the case that the admin has submitted the form with new settings if ($data = data_submitted() and confirm_sesskey()) { $count = admin_write_settings($data); - $adminroot =& admin_get_root(true); //reload tree + $adminroot = admin_get_root(true); //reload tree } $newsettings = admin_output_new_settings_by_page($adminroot); diff --git a/blocks/admin_bookmarks/block_admin_bookmarks.php b/blocks/admin_bookmarks/block_admin_bookmarks.php index cfefb41bbe..0cd292ea46 100644 --- a/blocks/admin_bookmarks/block_admin_bookmarks.php +++ b/blocks/admin_bookmarks/block_admin_bookmarks.php @@ -40,7 +40,7 @@ class block_admin_bookmarks extends block_base { if (get_user_preferences('admin_bookmarks')) { // this is expensive! Only require when bookmakrs exist.. require_once($CFG->libdir.'/adminlib.php'); - $adminroot =& admin_get_root(false, false); // settings not required - only pages + $adminroot = admin_get_root(false, false); // settings not required - only pages $bookmarks = explode(',', get_user_preferences('admin_bookmarks')); // hmm... just a liiitle (potentially) processor-intensive @@ -51,9 +51,9 @@ class block_admin_bookmarks extends block_base { foreach($bookmarks as $bookmark) { $temp = $adminroot->locate($bookmark); - if (is_a($temp, 'admin_settingpage')) { + if ($temp instanceof admin_settingpage) { $this->content->text .= '
  • ' . $temp->visiblename . "
  • \n"; - } else if (is_a($temp, 'admin_externalpage')) { + } else if ($temp instanceof admin_externalpage) { $this->content->text .= '
  • ' . $temp->visiblename . "
  • \n"; } } diff --git a/blocks/admin_bookmarks/create.php b/blocks/admin_bookmarks/create.php index 746c5cf37c..ef1c8286ac 100644 --- a/blocks/admin_bookmarks/create.php +++ b/blocks/admin_bookmarks/create.php @@ -4,7 +4,7 @@ require('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_login(); -$adminroot =& admin_get_root(false, false); // settings not required - only pages +$adminroot = admin_get_root(false, false); // settings not required - only pages if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey()) { @@ -22,7 +22,7 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey( $temp = $adminroot->locate($section); - if (is_a($temp, 'admin_settingpage') || is_a($temp, 'admin_externalpage')) { + if ($temp instanceof admin_settingpage || $temp instanceof admin_externalpage) { $bookmarks[] = $section; $bookmarks = implode(',', $bookmarks); set_user_preference('admin_bookmarks', $bookmarks); @@ -32,10 +32,10 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey( die; } - if (is_a($temp, 'admin_settingpage')) { + if ($temp instanceof admin_settingpage) { redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section); - } elseif (is_a($temp, 'admin_externalpage')) { + } elseif ($temp instanceof admin_externalpage) { redirect($temp->url); } diff --git a/blocks/admin_bookmarks/delete.php b/blocks/admin_bookmarks/delete.php index cc06f0600d..835ee6c121 100644 --- a/blocks/admin_bookmarks/delete.php +++ b/blocks/admin_bookmarks/delete.php @@ -5,7 +5,7 @@ require('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_login(); -$adminroot =& admin_get_root(false, false); // settings not required - only pages +$adminroot = admin_get_root(false, false); // settings not required - only pages if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey()) { @@ -26,9 +26,9 @@ if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey( $temp = $adminroot->locate($section); - if (is_a($temp, 'admin_externalpage')) { + if ($temp instanceof admin_externalpage) { redirect($temp->url, get_string('bookmarkdeleted','admin')); - } elseif (is_a($temp, 'admin_settingpage')) { + } elseif ($temp instanceof admin_settingpage) { redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section); } else { redirect($CFG->wwwroot); diff --git a/blocks/admin_tree/block_admin_tree.php b/blocks/admin_tree/block_admin_tree.php index d34900caae..ef6a3a6a35 100644 --- a/blocks/admin_tree/block_admin_tree.php +++ b/blocks/admin_tree/block_admin_tree.php @@ -57,7 +57,7 @@ class block_admin_tree extends block_base { function build_tree (&$content) { global $CFG; - if (is_a($content, 'admin_settingpage')) { + if ($content instanceof admin_settingpage) { // show hidden pages in tree if hidden page active if ($content->check_access() and (($content->name == $this->section) or !$content->is_hidden())) { $class = ($content->name == $this->section) ? 'link current' : 'link'; @@ -66,7 +66,7 @@ class block_admin_tree extends block_base { } $this->create_item($content->visiblename, $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section='.$content->name,$CFG->pixpath.'/i/item.gif', $class); } - } else if (is_a($content, 'admin_externalpage')) { + } else if ($content instanceof admin_externalpage) { // show hidden pages in tree if hidden page active if ($content->check_access() and (($content->name == $this->section) or !$content->is_hidden())) { $class = ($content->name == $this->section) ? 'link current' : 'link'; @@ -80,7 +80,7 @@ class block_admin_tree extends block_base { } $this->create_item($content->visiblename, $content->url, $CFG->pixpath.'/i/item.gif', $class); } - } else if (is_a($content, 'admin_category')) { + } else if ($content instanceof admin_category) { if ($content->check_access() and !$content->is_hidden()) { // check if the category we're currently printing is a parent category for the current page; if it is, we @@ -117,7 +117,7 @@ class block_admin_tree extends block_base { } require_once($CFG->libdir.'/adminlib.php'); - $adminroot =& admin_get_root(false, false); // settings not required - only pages + $adminroot = admin_get_root(false, false); // settings not required - only pages if ($current = $adminroot->locate($this->section, true)) { $this->pathtosection = $current->path; diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 0fe65dcd67..6ee4066a84 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -469,7 +469,7 @@ class block_base { } else { $page = page_create_object($this->instance->pagetype, $this->instance->pageid); } - $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey)); + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey())); if (empty($this->instance->pinned)) { $movebuttons .= '' . diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 1ce01c01e4..4fc064ca56 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -111,7 +111,7 @@ // This instance is configured - show Add/Edit feeds link. $script = $page->url_get_full( array('instanceid' => $this->instance->id, - 'sesskey' => $USER->sesskey, + 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $this->courseid, @@ -123,7 +123,7 @@ if (has_capability('block/rss_client:manageanyfeeds', $context)) { $script = $page->url_get_full( array('instanceid' => $this->instance->id, - 'sesskey' => $USER->sesskey, + 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $this->courseid, diff --git a/blocks/rss_client/config_instance.html b/blocks/rss_client/config_instance.html index 4375b8ca3d..9abb4d3bbc 100644 --- a/blocks/rss_client/config_instance.html +++ b/blocks/rss_client/config_instance.html @@ -104,7 +104,7 @@ print_box_start(); || has_capability('block/rss_client:createsharedfeeds', $context)) { $addrsspage = $page->url_get_full(array('instanceid' => $this->instance->id, - 'sesskey' => $USER->sesskey, + 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id)); diff --git a/blocks/rss_client/config_instance_tabs.php b/blocks/rss_client/config_instance_tabs.php index c3a7e3274c..24a6447753 100644 --- a/blocks/rss_client/config_instance_tabs.php +++ b/blocks/rss_client/config_instance_tabs.php @@ -13,12 +13,12 @@ if (empty($this->instance->pinned)) { } if (has_capability('moodle/site:manageblocks', $context)) { - $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss')); + $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss')); $row[] = new tabobject('configblock', $script, get_string('configblock', 'block_rss_client')); } -$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss')); +$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss')); $row[] = new tabobject('managefeeds', $script, get_string('managefeeds', 'block_rss_client')); diff --git a/course/category.php b/course/category.php index 3bc713f2e8..7129a805b7 100644 --- a/course/category.php +++ b/course/category.php @@ -423,7 +423,7 @@ unset($options); $options['id'] = $category->id; $options['resort'] = 'name'; - $options['sesskey'] = $USER->sesskey; + $options['sesskey'] = sesskey(); print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get'); } diff --git a/course/delete.php b/course/delete.php index 967126d980..480068a79d 100644 --- a/course/delete.php +++ b/course/delete.php @@ -41,7 +41,7 @@ notice_yesno("$strdeletecoursecheck

    " . format_string($course->fullname) . " (" . format_string($course->shortname) . ")", - "delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=$USER->sesskey", + "delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=".sesskey(), "category.php?id=$course->category"); print_footer($course); diff --git a/course/import/groups/index.php b/course/import/groups/index.php index b8f1ac2ce7..2dda3612c0 100755 --- a/course/import/groups/index.php +++ b/course/import/groups/index.php @@ -87,7 +87,7 @@ if ( !(isset($required[$h]) or isset($optionalDefaults[$h]) or isset($optional[$h])) ) { - print_error('invalidfieldname', 'error', 'index.php?id='.$id.'&sesskey='.$USER->sesskey, $h); + print_error('invalidfieldname', 'error', 'index.php?id='.$id.'&sesskey='.sesskey(), $h); } if ( isset($required[$h]) ) { $required[$h] = 2; @@ -96,7 +96,7 @@ // check for required fields foreach ($required as $key => $value) { if ($value < 2) { - print_error('fieldrequired', 'error', 'uploaduser.php?id='.$id.'&sesskey='.$USER->sesskey, $key); + print_error('fieldrequired', 'error', 'uploaduser.php?id='.$id.'&sesskey='.sesskey(), $key); } } $linenum = 2; // since header is line 1 @@ -121,7 +121,7 @@ foreach ($record as $name => $value) { // check for required values if (isset($required[$name]) and !$value) { - print_error('missingfield', 'error', 'uploaduser.php?sesskey='.$USER->sesskey, $name); + print_error('missingfield', 'error', 'uploaduser.php?sesskey='.sesskey(), $name); } else if ($name == "groupname") { $newgroup->name = $value; diff --git a/grade/import/grade_import_form.php b/grade/import/grade_import_form.php index 4ac9b4a3d6..ee0d9ce450 100755 --- a/grade/import/grade_import_form.php +++ b/grade/import/grade_import_form.php @@ -29,6 +29,12 @@ class grade_import_form extends moodleform { function definition (){ $mform =& $this->_form; + if (isset($this->_customdata)) { // hardcoding plugin names here is hacky + $features = $this->_customdata; + } else { + $features = array(); + } + // course id needs to be passed for auth purposes $mform->addElement('hidden', 'id', optional_param('id')); $mform->setType('id', PARAM_INT); @@ -41,6 +47,19 @@ class grade_import_form extends moodleform { $encodings = $textlib->get_encodings(); $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings); + if (!empty($features['includeseparator'])) { + $radio = array(); + $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab'); + $radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma'); + $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false); + $mform->setDefault('separator', 'comma'); + } + + if (!empty($features['verbosescales'])) { + $options = array(1=>get_string('yes'), 0=>get_string('no')); + $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options); + } + $options = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000); $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options); // TODO: localize $mform->setType('previewrows', PARAM_INT); @@ -106,6 +125,10 @@ class grade_import_mapping_form extends moodleform { $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'importcode'); $mform->setType('importcode', PARAM_FILE); + $mform->addElement('hidden', 'verbosescales', 1); + $mform->setType('separator', PARAM_ALPHA); + $mform->addElement('hidden', 'separator', 'comma'); + $mform->setType('verbosescales', PARAM_INT); $this->add_action_buttons(false, get_string('uploadgrades', 'grades')); } diff --git a/lang/en_utf8/qtype_randomsamatch.php b/lang/en_utf8/qtype_randomsamatch.php index 830f580333..2f8d9f55ad 100644 --- a/lang/en_utf8/qtype_randomsamatch.php +++ b/lang/en_utf8/qtype_randomsamatch.php @@ -1,4 +1,7 @@ nosaquestions short answer questions in the category that you chose \'$a->catname\'. Choose a different category, make some more questions in this category or reduce the amount of questions you\'ve selected.'; +$string['addingrandomsamatch'] = 'Adding a Random short-answer matching question'; +$string['editingrandomsamatch'] = 'Editing a Random short-answer matching question'; $string['nosaincategory'] = 'There are no short answer questions in the category that you chose \'$a->catname\'. Choose a different category, make some questions in this category.'; +$string['notenoughsaincategory'] = 'There is/are only $a->nosaquestions short answer questions in the category that you chose \'$a->catname\'. Choose a different category, make some more questions in this category or reduce the amount of questions you\'ve selected.'; +$string['randomsamatch'] = 'Random short-answer matching'; ?> \ No newline at end of file diff --git a/lang/en_utf8/qtype_shortanswer.php b/lang/en_utf8/qtype_shortanswer.php index 9a5d85ba38..6da6bf7150 100644 --- a/lang/en_utf8/qtype_shortanswer.php +++ b/lang/en_utf8/qtype_shortanswer.php @@ -1,6 +1,9 @@ \ No newline at end of file diff --git a/mod/feedback/analysis.php b/mod/feedback/analysis.php index 0684f3bc72..f3c8a6a8ab 100644 --- a/mod/feedback/analysis.php +++ b/mod/feedback/analysis.php @@ -118,7 +118,7 @@ // echo '
    '; switch ($feedback->anonymous) { case FEEDBACK_ANONYMOUS_YES: @@ -423,7 +423,7 @@ echo ''; } } - echo ''; + echo ''; echo ''; echo ''; echo ''; diff --git a/mod/lesson/action/confirmdelete.php b/mod/lesson/action/confirmdelete.php index 6b1b10d6ba..af580c0cde 100644 --- a/mod/lesson/action/confirmdelete.php +++ b/mod/lesson/action/confirmdelete.php @@ -26,6 +26,6 @@ } } notice_yesno(get_string("confirmdeletionofthispage","lesson"), - "lesson.php?action=delete&id=$cm->id&pageid=$pageid&sesskey=".$USER->sesskey, + "lesson.php?action=delete&id=$cm->id&pageid=$pageid&sesskey=".sesskey(), "view.php?id=$cm->id"); ?> diff --git a/mod/quiz/settingslib.php b/mod/quiz/settingslib.php index 8c8843cf3d..5768d4152e 100644 --- a/mod/quiz/settingslib.php +++ b/mod/quiz/settingslib.php @@ -18,9 +18,9 @@ class admin_setting_quiz_reviewoptions extends admin_setting { QUIZ_REVIEW_SCORES => 'scores', QUIZ_REVIEW_OVERALLFEEDBACK => 'overallfeedback'); - function __construct($name, $visiblename, $description, $defaultsetting) { + public function __construct($name, $visiblename, $description, $defaultsetting) { $this->plugin = 'quiz'; - parent::admin_setting($name, $visiblename, $description, $defaultsetting); + parent::__construct($name, $visiblename, $description, $defaultsetting); } private function normalise_data($data) { @@ -35,7 +35,7 @@ class admin_setting_quiz_reviewoptions extends admin_setting { return $value; } - function get_setting() { + public function get_setting() { $value = $this->config_read($this->name); $fix = $this->config_read('fix_' . $this->name); if (is_null($value) or is_null($fix)) { @@ -44,7 +44,7 @@ class admin_setting_quiz_reviewoptions extends admin_setting { return array('value' => $value, 'fix' => $fix); } - function write_setting($data) { + public function write_setting($data) { if (!isset($data['value'])) { $data['value'] = $this->normalise_data($data); } @@ -62,7 +62,7 @@ class admin_setting_quiz_reviewoptions extends admin_setting { return ''; } - function output_html($data, $query='') { + public function output_html($data, $query='') { if (!isset($data['value'])) { $data['value'] = $this->normalise_data($data); } diff --git a/question/type/missingtype/questiontype.php b/question/type/missingtype/questiontype.php index 1bbdcf6d41..d3f1255b09 100644 --- a/question/type/missingtype/questiontype.php +++ b/question/type/missingtype/questiontype.php @@ -63,7 +63,7 @@ class question_missingtype_qtype extends default_questiontype { function display_question_editing_page(&$mform, $question, $wizardnow){ - print_heading(get_string('warningmissingtype', 'quiz')); + print_heading(get_string('warningmissingtype', 'qtype_missingtype')); $mform->display(); diff --git a/repository/boxnet/class.curl.php b/repository/boxnet/class.curl.php deleted file mode 100755 index 88d387822d..0000000000 --- a/repository/boxnet/class.curl.php +++ /dev/null @@ -1,358 +0,0 @@ -m_header['Set-Cookie'][0] and ...[1] - * - * @access private - * @var mixed - */ - - var $m_header ; - - /** - * Current setting of the curl options. - * - * @access private - * @var mixed - */ - - var $m_options ; - - /** - * Status information for the last executed http request. Includes the errno and error - * in addition to the information returned by curl_getinfo. - * - * The keys defined are those returned by curl_getinfo with two additional - * ones specified, 'error' which is the value of curl_error and 'errno' which - * is the value of curl_errno. - * - * @link http://www.php.net/curl_getinfo - * @link http://www.php.net/curl_errno - * @link http://www.php.net/curl_error - * @access private - * @var mixed - */ - - var $m_status ; - - /** - * curl class constructor - * - * Initializes the curl class for it's default behavior: - * o no HTTP headers. - * o return the transfer as a string. - * o URL to access. - * By default, the curl class will simply read the URL provided - * in the constructor. - * - * @link http://www.php.net/curl_init - * @param string $theURL [optional] the URL to be accessed by this instance of the class. - */ - - function curl($theURL=null) - { - if (!function_exists('curl_init')) - { - trigger_error('PHP was not built with --with-curl, rebuild PHP to use the curl class.', E_USER_ERROR) ; - } - - $this->m_handle = curl_init() ; - - $this->m_caseless = null ; - $this->m_header = null ; - $this->m_options = null ; - $this->m_status = null ; - - if (!empty($theURL)) - { - $this->setopt(CURLOPT_URL, $theURL) ; - } - $this->setopt(CURLOPT_HEADER, false) ; - $this->setopt(CURLOPT_RETURNTRANSFER, true) ; - } - - /** - * Free the resources associated with the curl session. - * - * @link http://www.php.net/curl_close - */ - - function close() - { - curl_close($this->m_handle) ; - $this->m_handle = null ; - } - - /** - * Execute the curl request and return the result. - * - * @link http://www.php.net/curl_exec - * @link http://www.php.net/curl_getinfo - * @link http://www.php.net/curl_errno - * @link http://www.php.net/curl_error - * @return string The contents of the page (or other interaction as defined by the - * settings of the various curl options). - */ - - function exec() - { - $theReturnValue = curl_exec($this->m_handle) ; - - $this->m_status = curl_getinfo($this->m_handle) ; - $this->m_status['errno'] = curl_errno($this->m_handle) ; - $this->m_status['error'] = curl_error($this->m_handle) ; - - // - // Parse out the http header (if any). - // - - $this->m_header = null ; - - if ($this->getOption(CURLOPT_HEADER)) - { - $theArray = preg_split("/(\r\n){2,2}/", $theReturnValue, 2) ; - - $this->parseHeader($theArray[0]) ; - - return $theArray[1] ; - } - - return $theReturnValue ; - } - - /** - * Returns the parsed http header. - * - * @param string $theHeader [optional] the name of the header to be returned. - * The name of the header is case insensitive. If - * the header name is omitted the parsed header is - * returned. If the requested header doesn't exist - * false is returned. - * @returns mixed - */ - - function getHeader($theHeader=null) - { - if (empty($theHeader)) - { - return $this->m_header ; - } - else - { - $theHeader = strtoupper($theHeader) ; - if (isset($this->m_caseless[$theHeader])) - { - return $this->m_header[$this->m_caseless[$theHeader]] ; - } - else - { - return false ; - } - } - } - - /** - * Returns the current setting of the request option. If no - * option has been set, it return null. - * - * @param integer the requested CURLOPT. - * @returns mixed - */ - - function getOption($theOption) - { - if (isset($this->m_options[$theOption])) - { - return $this->m_options[$theOption] ; - } - - return null ; - } - - /** - * Did the last curl exec operation have an error? - * - * @return mixed The error message associated with the error if an error - * occurred, false otherwise. - */ - - function hasError() - { - if (isset($this->m_status['error'])) - { - return (empty($this->m_status['error']) ? false : $this->m_status['error']) ; - } - else - { - return false ; - } - } - - /** - * Parse an HTTP header. - * - * As a side effect it stores the parsed header in the - * m_header instance variable. The header is stored as - * an associative array and the case of the headers - * as provided by the server is preserved and all - * repeated headers (pragma, set-cookie, etc) are grouped - * with the first spelling for that header - * that is seen. - * - * All headers are stored as if they COULD be repeated, so - * the headers are really stored as an array of arrays. - * - * @param string $theHeader The HTTP data header. - */ - - function parseHeader($theHeader) - { - $this->m_caseless = array() ; - - $theArray = preg_split("/(\r\n)+/", $theHeader) ; - - // - // Ditch the HTTP status line. - // - - if (preg_match('/^HTTP/', $theArray[0])) - { - $theArray = array_slice($theArray, 1) ; - } - - foreach ($theArray as $theHeaderString) - { - $theHeaderStringArray = preg_split("/\s*:\s*/", $theHeaderString, 2) ; - - $theCaselessTag = strtoupper($theHeaderStringArray[0]) ; - - if (!isset($this->m_caseless[$theCaselessTag])) - { - $this->m_caseless[$theCaselessTag] = $theHeaderStringArray[0] ; - } - - $this->m_header[$this->m_caseless[$theCaselessTag]][] = $theHeaderStringArray[1] ; - } - } - - /** - * Return the status information of the last curl request. - * - * @param string $theField [optional] the particular portion - * of the status information desired. - * If omitted the array of status - * information is returned. If a non-existant - * status field is requested, false is returned. - * @returns mixed - */ - - function getStatus($theField=null) - { - if (empty($theField)) - { - return $this->m_status ; - } - else - { - if (isset($this->m_status[$theField])) - { - return $this->m_status[$theField] ; - } - else - { - return false ; - } - } - } - - /** - * Set a curl option. - * - * @link http://www.php.net/curl_setopt - * @param mixed $theOption One of the valid CURLOPT defines. - * @param mixed $theValue the value of the curl option. - */ - - function setopt($theOption, $theValue) - { - curl_setopt($this->m_handle, $theOption, $theValue) ; - $this->m_options[$theOption] = $theValue ; - } -} -?> \ No newline at end of file diff --git a/repository/flickr/PEAR/HTTP/Request/Listener.php b/repository/flickr/PEAR/HTTP/Request/Listener.php deleted file mode 100755 index b6c3facf6f..0000000000 --- a/repository/flickr/PEAR/HTTP/Request/Listener.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @copyright 2002-2007 Richard Heyes - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/HTTP_Request/ - */ - -/** - * Listener for HTTP_Request and HTTP_Response objects - * - * This class implements the Observer part of a Subject-Observer - * design pattern. - * - * @category HTTP - * @package HTTP_Request - * @author Alexey Borzov - * @version Release: 1.4.2 - */ -class HTTP_Request_Listener -{ - /** - * A listener's identifier - * @var string - */ - var $_id; - - /** - * Constructor, sets the object's identifier - * - * @access public - */ - function HTTP_Request_Listener() - { - $this->_id = md5(uniqid('http_request_', 1)); - } - - - /** - * Returns the listener's identifier - * - * @access public - * @return string - */ - function getId() - { - return $this->_id; - } - - - /** - * This method is called when Listener is notified of an event - * - * @access public - * @param object an object the listener is attached to - * @param string Event name - * @param mixed Additional data - * @abstract - */ - function update(&$subject, $event, $data = null) - { - echo "Notified of event: '$event'\n"; - if (null !== $data) { - echo "Additional data: "; - var_dump($data); - } - } -} -?> -- 2.39.5