public function get_menuitem($editing = false, $yui = false) { if (empty($this->link->id) or empty($this->config->pageid)) { return false; } if (!($page = page_get($this->config->pageid))) { // Probably deleted :( return false; } // Set editing to avoid passing it everywhere $this->editing = $editing; $this->yui = $yui; // Load the page with child tree(s) $page->children = page_get_children($page->id, 'nested', $page->courseid); // Generate menu item tree return $this->page_to_menuitem($page); }
/** * Makes sure that the current page ID * is an actual page ID and if the page * is published. If not published, * then do a capability check to see * if the user can view unpubplished pages * * @param int $pageid ID to process * @param int $courseid ID of the current courese * @return mixed Page object or false **/ function page_validate_pageid($pageid, $courseid) { $return = false; $pageid = clean_param($pageid, PARAM_INT); if ($pageid > 0 and $page = page_get($pageid, $courseid)) { if ($page->courseid == $courseid and ($page->display & DISP_PUBLISH or has_capability('format/page:editpages', get_context_instance(CONTEXT_COURSE, $page->courseid)))) { // This page belongs to this course and is published or the current user can see unpublished pages $return = $page; } } return $return; }
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2004 ReloadCMS Development Team // // http://reloadcms.sf.net // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY, without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if (!empty($_GET['id'])) { $langs = array_keys(page_get_langs($_GET['id'])); if (empty($langs)) { $system->showModuleWindow('', $lang['results']['general'][11]); } elseif (!empty($_POST['page_lang']) && ($page = page_get($_GET['id'], $_POST['page_lang']))) { $system->config['pagename'] = $page['title']; $system->showModuleWindow($page['title'], $page['text']); } elseif (count($langs) == 1 && ($page = page_get($_GET['id'], $langs[0]))) { $system->config['pagename'] = $page['title']; $system->showModuleWindow($page['title'], $page['text']); } else { $system->config['pagename'] = $lang['general']['pagelang']; $system->showModuleWindow($lang['general']['pagelang'], rcms_parse_module_template('pages-lang-sel.tpl', $langs)); } } else { $system->showModuleWindow('', $lang['results']['general'][11]); }
/// Set course display if ($pageid > 0) { $pageid = page_set_current_page($course->id, $pageid); } else { if ($page = page_get_current_page($course->id)) { $displayid = $page->id; } else { $displayid = 0; } $pageid = page_set_current_page($course->id, $displayid); } /// Check out the $pageid - set? valid? belongs to this course? if (!empty($pageid)) { if (empty($page) or $page->id != $pageid) { // Didn't get the page above or we got the wrong one... if (!($page = page_get($pageid))) { error('Invalid page ID'); } } // Ensure this page is with this course if ($page->courseid != $course->id) { error(get_string('invalidpageid', 'format_page', $pageid)); } } else { // We don't have a page ID to work with if (has_capability('format/page:editpages', $context)) { $action = 'editpage'; $page = new stdClass(); $page->id = 0; } else { // Nothing this person can do about it, error out
theme_advanced_resizing : true, paste_auto_cleanup_on_paste : true, content_css: \'/css/tinymce.css\', extended_valid_elements : \'script[type|language|src]\', forced_root_block : \'\', force_br_newlines : true, force_p_newlines : false }); $(\'table.bb_editor\').hide();} else { tinyMCE.get(\'text\').hide(); $(\'table.bb_editor\').show(); }"'), 'top'); $frm->addrow(__('Date') . ' (yyyy-mm-dd hh:mm:ss)', $frm->text_box('date', gmdate("Y-m-d H:i:s", rcms_get_time())), 'top'); $frm->show(); } elseif ($edited = post('edit', get('page'))) { if ($page = page_get($edited)) { $frm = new InputForm('', 'post', __('Submit'), '', '', '', 'edit'); $frm->addbreak(__('Edit article')); $frm->hidden('edit', $edited); $frm->hidden('save', '1'); $frm->addrow('<abbr title="' . __('Use only small Latin letters and digits') . '">' . __('MenuID') . '</abbr>', $frm->text_box('id', $edited)); $frm->addrow(__('Title'), $frm->text_box('title', $page['title'])); if (empty($page['description'])) { $page['description'] = $page['title']; } $frm->addrow(__('Description for search engines'), $frm->text_box('description', $page['description'])); if (empty($page['keywords'])) { $page['keywords'] = ''; } $frm->addrow(__('Keywords'), $frm->text_box('keywords', $page['keywords'])); $frm->addrow('', rcms_show_bbcode_panel('edit.text'));
} //////////////////////////////////////////////////////////////////////////////// // Interface generation // //////////////////////////////////////////////////////////////////////////////// if (!empty($_POST['new'])) { $frm = new InputForm("", "post", $lang['general']['submit']); $frm->addmessage('<a href=""><<< ' . $lang['general']['back'] . '</a>'); $frm->addbreak($lang['admincp']['general']['pages']['create']); $frm->hidden('newsave', '1'); $frm->addrow('<abbr title="' . $lang['general']['pages']['pageid_h'] . '">' . $lang['general']['pages']['pageid'] . '</abbr>', $frm->text_box('name', '')); $frm->addrow('<abbr title="' . $lang['general']['pages']['pageid_h'] . '">' . $lang['general']['pages']['pagelang'] . '</abbr>', $frm->text_box('lang', '')); $frm->addrow($lang['general']['pages']['pagetitle'], $frm->text_box('title', '')); $frm->addrow($lang['general']['pages']['pagetext'] . '<br>' . $lang['general']['pages']['pagetext_h'], $frm->textarea('text', '', 70, 25), 'top'); $frm->show(); } elseif (!empty($_POST['edit'])) { if (($pd = explode('.', $_POST['edit'])) && ($page = page_get($pd[0], $pd[1]))) { $frm = new InputForm("", "post", $lang['general']['submit']); $frm->addmessage('<a href=""><<< ' . $lang['general']['back'] . '</a>'); $frm->addbreak($lang['admincp']['general']['pages']['edit']); $frm->hidden('edit', $pd[0] . '.' . $pd[1]); $frm->hidden('save', '1'); $frm->addrow('<abbr title="' . $lang['general']['pages']['pageid_h'] . '">' . $lang['general']['pages']['pageid'] . '</abbr>', $frm->text_box('name', $pd[0])); $frm->addrow('<abbr title="' . $lang['general']['pages']['pageid_h'] . '">' . $lang['general']['pages']['pagelang'] . '</abbr>', $frm->text_box('lang', $pd[1])); $frm->addrow($lang['general']['pages']['pagetitle'], $frm->text_box('title', $page['title'])); $frm->addrow($lang['general']['pages']['pagetext'] . '<br>' . $lang['general']['pages']['pagetext_h'], $frm->textarea('text', $page['text'], 70, 25), 'top'); $frm->show(); } else { rcms_showAdminMessage($lang['results']['general'][8]); } } else { $frm = new InputForm('', 'post', $lang['general']['createpage']);