Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 83... Línea 83...
83
        $rss =  new moodle_simplepie();
83
        $rss =  new moodle_simplepie();
84
        // set timeout for longer than normal to try and grab the feed
84
        // set timeout for longer than normal to try and grab the feed
85
        $rss->set_timeout(10);
85
        $rss->set_timeout(10);
86
        $rss->set_feed_url($data['url']);
86
        $rss->set_feed_url($data['url']);
87
        $rss->set_autodiscovery_cache_duration(0);
87
        $rss->set_autodiscovery_cache_duration(0);
88
        $rss->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
88
        $rss->set_autodiscovery_level(\SimplePie\SimplePie::LOCATOR_NONE);
89
        $rss->init();
89
        $rss->init();
Línea 90... Línea 90...
90
 
90
 
91
        if ($rss->error()) {
91
        if ($rss->error()) {
92
            $errors['url'] = get_string('couldnotfindloadrssfeed', 'block_rss_client');
92
            $errors['url'] = get_string('couldnotfindloadrssfeed', 'block_rss_client');
Línea 127... Línea 127...
127
     * @return string URL of feed or original url if none found
127
     * @return string URL of feed or original url if none found
128
     */
128
     */
129
    public static function autodiscover_feed_url($url){
129
    public static function autodiscover_feed_url($url){
130
            $rss =  new moodle_simplepie();
130
            $rss =  new moodle_simplepie();
131
            $rss->set_feed_url($url);
131
            $rss->set_feed_url($url);
132
            $rss->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL);
132
            $rss->set_autodiscovery_level(\SimplePie\SimplePie::LOCATOR_ALL);
133
            // When autodiscovering an RSS feed, simplepie will try lots of
133
            // When autodiscovering an RSS feed, simplepie will try lots of
134
            // rss links on a page, so set the timeout high
134
            // rss links on a page, so set the timeout high
135
            $rss->set_timeout(20);
135
            $rss->set_timeout(20);
136
            $rss->init();
136
            $rss->init();
Línea 178... Línea 178...
178
$PAGE->set_url('/blocks/rss_client/editfeed.php', $urlparams);
178
$PAGE->set_url('/blocks/rss_client/editfeed.php', $urlparams);
179
$PAGE->set_pagelayout('admin');
179
$PAGE->set_pagelayout('admin');
Línea 180... Línea 180...
180
 
180
 
181
if ($rssid) {
181
if ($rssid) {
-
 
182
    $isadding = false;
-
 
183
 
-
 
184
    if ($managesharedfeeds) {
-
 
185
        $select = 'id = :id AND (userid = :userid OR shared = 1)';
-
 
186
    } else {
-
 
187
        $select = 'id = :id AND userid = :userid';
-
 
188
    }
182
    $isadding = false;
189
 
-
 
190
    $rssrecord = $DB->get_record_select('block_rss_client', $select, [
-
 
191
        'id' => $rssid,
-
 
192
        'userid' => $USER->id,
-
 
193
    ], '*', MUST_EXIST);
183
    $rssrecord = $DB->get_record('block_rss_client', array('id' => $rssid), '*', MUST_EXIST);
194
 
184
} else {
195
} else {
185
    $isadding = true;
196
    $isadding = true;
186
    $rssrecord = new stdClass;
197
    $rssrecord = new stdClass;