Example #1
0
 function &handle()
 {
     $req =& get_request("MW_RenameRequest");
     $page =& get_current_page();
     $new_name = $req->get_new_name();
     if ($new_name === null) {
         $special_page = load_special_page(MW_SPECIAL_PAGE_RENAME);
         if ($special_page !== null) {
             render_ui(MW_LAYOUT_HEADER, _t("Renaming %0%", $page->name));
             $special_page->render();
             render_ui(MW_LAYOUT_FOOTER);
             return null_ref();
         }
     } else {
         $success = $page->rename($new_name);
         add_info_text($success ? _t("Page renamed.") : _t("Page not renamed."));
         # will not redirect itself
         if ($success && is_a($page, "MW_SpecialUploadPage")) {
             $new_page = new_upload_page($new_name, MW_REVISION_HEAD);
             set_current_page($new_page);
         }
     }
     return get_default_action();
 }
 function get_wiki_content()
 {
     if ($this->is_data_page) {
         return "[[" . $this->name . "]]";
     } else {
         $layout_page = load_special_page(MW_SPECIAL_PAGE_UPLOAD);
         if ($layout_page !== null) {
             $link_prefix = strpos($this->mime_type, "image/") === 0 ? MW_LINK_NAME_PREFIX_IMAGE : MW_PAGE_NAME_PREFIX_DATA;
             return wiki_include($layout_page, array('download_link' => $link_prefix . $this->upload_name . ($this->revision != MW_REVISION_HEAD ? '$' . $this->revision : ''), 'filename' => $this->upload_name, 'mimetype' => $this->mime_type), false, false);
         }
     }
 }
Example #3
0
 function get_wiki_content()
 {
     $special_page = load_special_page(MW_SPECIAL_PAGE_USER);
     if ($special_page !== null) {
         return wiki_include($special_page, array('related_user' => $this->related_user, 'user_page_content' => $this->page->get_wiki_content()), false, false);
     }
 }