sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( 'load' => 'xmldb', 'create' => 'xmldb', 'edit' => 'xmldb', 'save' => 'xmldb', 'revert' => 'xmldb', 'unload' => 'xmldb', 'delete' => 'xmldb', 'reservedwords' => 'xmldb', 'test' => 'xmldb', 'gotolastused' => 'xmldb', 'checkindexes' => 'xmldb', 'checkbigints' => 'xmldb' )); } /** * Invoke method, every class will have its own * returns true/false on completion, setting both * errormsg and output as necessary */ function invoke() { parent::invoke(); $result = true; /// Set own core attributes $this->does_generate = ACTION_GENERATE_HTML; /// These are always here global $CFG, $XMLDB, $SESSION; /// Get lastused $o = ''; if (isset($SESSION->lastused)) { if ($lastused = $SESSION->lastused) { /// Print link $o .= '
' . $this->str['gotolastused'] . '
'; } } else { $lastused = NULL; } /// Calculate the buttons $b = ' '; /// Send buttons to output $o .= $b; /// Do the job /// Get the list of DB directories $result = $this->launch('get_db_directories'); /// Display list of DB directories if everything is ok if ($result && !empty($XMLDB->dbdirs)) { $o .= ''; /// The create button if ($dbdir->path_exists && !file_exists($key . '/install.xml') && is_writeable($key)) { $b .= '[' . $this->str['create'] . ']'; } else { $b .= '[' . $this->str['create'] . ']'; } $b .= ' | '; /// The load button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml') && empty($dbdir->xml_loaded)) { $b .= '[' . $this->str['load'] . ']'; } else { $b .= '[' . $this->str['load'] . ']'; } $b .= ' | '; /// The edit button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml') && is_readable($key) && !empty($dbdir->xml_loaded)) { $b .= '[' . $this->str['edit'] . ']'; } else { $b .= '[' . $this->str['edit'] . ']'; } $b .= ' | '; /// The save button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_writeable($key . '/install.xml') && is_writeable($key) && !empty($dbdir->xml_loaded) && !empty($dbdir->xml_changed)) { $b .= '[' . $this->str['save'] . ']'; /// Check if the file has been manually edited while being modified in the editor if ($dbdir->filemtime != filemtime($key . '/install.xml')) { /// File manually modified. Add to errors. if ($structure =& $dbdir->xml_file->getStructure()) { $structure->errormsg = 'Warning: File locally modified while using the XMLDB Editor. Saving will overwrite local changes'; } } } else { $b .= '[' . $this->str['save'] . ']'; } $b .= ' | '; /// The revert button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml') && is_writeable($key) && !empty($dbdir->xml_loaded) && !empty($dbdir->xml_changed)) { $b .= '[' . $this->str['revert'] . ']'; } else { $b .= '[' . $this->str['revert'] . ']'; } $b .= ' | '; /// The unload button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml') && !empty($dbdir->xml_loaded) && empty($dbdir->xml_changed)) { $b .= '[' . $this->str['unload'] . ']'; } else { $b .= '[' . $this->str['unload'] . ']'; } $b .= ' | '; /// The delete button if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml') && is_writeable($key) && empty($dbdir->xml_loaded)) { $b .= '[' . $this->str['delete'] . ']'; } else { $b .= '[' . $this->str['delete'] . ']'; } $b .= ' | '; /// if the file, exist, XML is viewable if ($dbdir->path_exists && file_exists($key . '/install.xml') && is_readable($key . '/install.xml')) { $elementtext = '' . $elementtext . ''; } else { $elementtext = $elementtext . ''; } /// include the higlight if ($hithis) { $o .= '|
' . $elementtext . $b . ' | |||||||
' . $elementtext . $b . ' | |||||||
' . implode (', ', $errors) . ' | |||||||
' . implode (', ', $errors) . ' |