Пример #1
0
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Handles what happens when a user with appropriate permission attempts to
 * override a wiki page editing lock.
 *
 * @copyright &copy; 2007 The Open University
 * @author s.marshall@open.ac.uk
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package ouwiki
 */
require_once dirname(__FILE__) . '/../../config.php';
require $CFG->dirroot . '/mod/ouwiki/basicpage.php';
if (!data_submitted()) {
    print_error("Only POST requests accepted");
}
if (!has_capability('mod/ouwiki:overridelock', $context)) {
    print_error("You do not have the capability to override editing locks");
}
$pageversion = ouwiki_get_current_page($subwiki, $pagename, OUWIKI_GETPAGE_ACCEPTNOVERSION);
ouwiki_override_lock($pageversion->pageid);
$redirpage = optional_param('redirpage', '', PARAM_ALPHA);
if ($redirpage != '') {
    redirect($redirpage . '.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL), '', 0);
} else {
    redirect('edit.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL), '', 0);
}
Пример #2
0
     } else {
         $ipagename = $index[$page]->title;
     }
     if ($ipagename == '' && $startpagemerge == 1) {
         // If start page exists then set imported start page in conflicts array.
         if (ouwiki_get_current_page($subwiki, $ipagename, OUWIKI_GETPAGE_ACCEPTNOVERSION)) {
             $conflicts[$page] = $ipagename;
         }
         // Doesn't matter if start page is locked - when adding links check and skip if is.
         continue;
     }
     // Check if this page already exists, and is locked.
     if ($currentpageexists = ouwiki_get_current_page($subwiki, $ipagename, OUWIKI_GETPAGE_ACCEPTNOVERSION)) {
         $conflicts[$page] = $ipagename;
         if (has_capability('mod/ouwiki:overridelock', $context)) {
             ouwiki_override_lock($currentpageexists->pageid);
         }
         list($lock, $by) = ouwiki_obtain_lock($ouwiki, $currentpageexists->pageid);
         if ($currentpageexists->locked) {
             $lock = false;
             // No one can edit.
         }
         if (!$lock) {
             throw new moodle_exception('import_process_locked', 'ouwiki');
         }
     }
 }
 $newpagelist = array();
 // Use to store names of new pages imported.
 $updatepagelist = array();
 $importedindex = array();