mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
Nuked nuke.
This commit is contained in:
parent
ad48842401
commit
09a89b01d0
@ -708,60 +708,4 @@ class block_list extends block_base {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for supporting a phpnuke style block as a moodle block
|
||||
*
|
||||
* @author Jon Papaioannou
|
||||
* @package blocks
|
||||
*/
|
||||
class block_nuke extends block_base {
|
||||
|
||||
var $content_type = BLOCK_TYPE_NUKE;
|
||||
|
||||
function get_content() {
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
global $CFG;
|
||||
$this->content = &New stdClass;
|
||||
|
||||
// This whole thing begs to be written for PHP >= 4.3.0 using glob();
|
||||
$dir = $CFG->dirroot .'/blocks/'. $this->name() .'/nuke/';
|
||||
if ($dh = @opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
$regs = array();
|
||||
if (ereg('^block\-(.*)\.php$', $file, $regs)) {
|
||||
// Found it! Let's prepare the environment...
|
||||
|
||||
$oldvals = array();
|
||||
if (isset($GLOBALS['admin'])) {
|
||||
$oldvals['admin'] = $GLOBALS['admin'];
|
||||
}
|
||||
|
||||
// isteacher() will eventually be deprecated and blocks
|
||||
// should define their own capabilities.
|
||||
$GLOBALS['admin'] = isteacher($this->course->id);
|
||||
|
||||
@include($dir.$file);
|
||||
|
||||
foreach($oldvals as $key => $val) {
|
||||
$GLOBALS[$key] = $val;
|
||||
}
|
||||
|
||||
// We should have $content set now
|
||||
if (!isset($content)) {
|
||||
return NULL;
|
||||
}
|
||||
return $this->content->text = $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we reached here, we couldn't find the nuke block for some reason
|
||||
return $this->content->text = get_string('blockmissingnuke');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user