$WT_TREE = $tree; if ($WT_TREE->tree_name == $GEDCOM && ($WT_TREE->imported || Auth::isAdmin())) { break; } } // These attributes of the currently-selected tree are used frequently if ($WT_TREE) { define('WT_GEDCOM', $WT_TREE->tree_name); define('WT_GED_ID', $WT_TREE->tree_id); define('WT_GEDURL', $WT_TREE->tree_name_url); define('WT_TREE_TITLE', $WT_TREE->tree_title_html); define('WT_IMPORTED', $WT_TREE->imported); define('WT_USER_GEDCOM_ADMIN', Auth::isManager($WT_TREE)); define('WT_USER_CAN_ACCEPT', Auth::isModerator($WT_TREE)); define('WT_USER_CAN_EDIT', Auth::isEditor($WT_TREE)); define('WT_USER_CAN_ACCESS', Auth::isMember($WT_TREE)); define('WT_USER_GEDCOM_ID', $WT_TREE->userPreference(WT_USER_ID, 'gedcomid')); define('WT_USER_ROOT_ID', $WT_TREE->userPreference(WT_USER_ID, 'rootid') ? $WT_TREE->userPreference(WT_USER_ID, 'rootid') : WT_USER_GEDCOM_ID); define('WT_USER_PATH_LENGTH', $WT_TREE->userPreference(WT_USER_ID, 'RELATIONSHIP_PATH_LENGTH')); if (WT_USER_GEDCOM_ADMIN) { define('WT_USER_ACCESS_LEVEL', WT_PRIV_NONE); } elseif (WT_USER_CAN_ACCESS) { define('WT_USER_ACCESS_LEVEL', WT_PRIV_USER); } else { define('WT_USER_ACCESS_LEVEL', WT_PRIV_PUBLIC); } load_gedcom_settings(WT_GED_ID); } else { define('WT_GEDCOM', ''); define('WT_GED_ID', null); define('WT_GEDURL', '');
// the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // 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. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'editnews.php'); require './includes/session.php'; $controller = new WT_Controller_Simple(); $controller->setPageTitle(WT_I18N::translate('Add/edit a journal/news entry'))->restrictAccess(Auth::isMember())->pageHeader(); $action = WT_Filter::get('action', 'compose|save|delete', 'compose'); $news_id = WT_Filter::getInteger('news_id'); $user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER)); $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER)); $date = WT_Filter::postInteger('date', 0, PHP_INT_MAX, WT_TIMESTAMP); $title = WT_Filter::post('title'); $text = WT_Filter::post('text'); switch ($action) { case 'compose': if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } echo '<h3>' . WT_I18N::translate('Add/edit a journal/news entry') . '</h3>'; echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">'; if ($news_id) {
if (array_key_exists($module_name, $all_blocks)) { $class_name = $module_name . '_WT_Module'; $module = new $class_name(); $module->getBlock($block_id); } if (WT_DEBUG) { echo execution_stats(); } if (WT_DEBUG_SQL) { echo WT_DB::getQueryLog(); } exit; } $controller = new WT_Controller_Page(); if ($ctype == 'user') { $controller->restrictAccess(Auth::isMember()); } $controller->setPageTitle($ctype == 'user' ? WT_I18N::translate('My page') : WT_TREE_TITLE)->setMetaRobots('index,follow')->setCanonicalUrl(WT_SCRIPT_NAME . '?ctype=' . $ctype . '&ged=' . WT_GEDCOM)->pageHeader()->addInlineJavascript('jQuery.ajaxSetup({cache:true});'); if ($ctype == 'user') { echo '<div id="my-page">'; echo '<h1 class="center">', WT_I18N::translate('My page'), '</h1>'; } else { echo '<div id="home-page">'; } if ($blocks['main']) { if ($blocks['side']) { echo '<div id="index_main_blocks">'; } else { echo '<div id="index_full_blocks">'; } foreach ($blocks['main'] as $block_id => $module_name) {
require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $pid = WT_Filter::get('pid', WT_REGEX_XREF, WT_Filter::post('pid', WT_REGEX_XREF)); // edit this media object $linktoid = WT_Filter::get('linktoid', WT_REGEX_XREF, WT_Filter::post('linktoid', WT_REGEX_XREF)); // create a new media object, linked to this record $action = WT_Filter::get('action', null, WT_Filter::post('action')); $filename = WT_Filter::get('filename', null, WT_Filter::post('filename')); $text = WT_Filter::postArray('text'); $tag = WT_Filter::postArray('tag', WT_REGEX_TAG); $islink = WT_Filter::postArray('islink'); $glevels = WT_Filter::postArray('glevels', '[0-9]'); $folder = WT_Filter::post('folder'); $update_CHAN = !WT_Filter::postBool('preserve_last_changed'); $controller = new WT_Controller_Simple(); $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember()); $disp = true; $media = WT_Media::getInstance($pid); if ($media) { $disp = $media->canShow(); } if ($action == 'update' || $action == 'create') { if ($linktoid) { $disp = WT_GedcomRecord::getInstance($linktoid)->canShow(); } } if (!WT_USER_CAN_EDIT || !$disp) { $controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();'); exit; } // TODO - there is a lot of common code in the create and update cases....