"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/handler/page/edit.php" between
wacko.6.1.14.zip and wacko.6.1.15.zip

About: WackoWiki is a multilingual Wiki-engine that supports WYTIWYG-editing, page rights (ACLs), design themes (skins), file upload, email notification and much more.

edit.php  (wacko.6.1.14):edit.php  (wacko.6.1.15)
skipping to change at line 35 skipping to change at line 35
$this->http->redirect($this->href('new', $this->db->root_page)); $this->http->redirect($this->href('new', $this->db->root_page));
} }
// invoke autocomplete if needed // invoke autocomplete if needed
if ((isset($_GET['_autocomplete'])) && $_GET['_autocomplete']) if ((isset($_GET['_autocomplete'])) && $_GET['_autocomplete'])
{ {
include __DIR__ . '/_autocomplete.php'; include __DIR__ . '/_autocomplete.php';
return; return;
} }
$user = $this->get_user(); $user = $this->get_user();
$page_id = $this->page['page_id'];
// is comment? // is comment?
if (isset($this->page['comment_on_id']) && $this->page['comment_on_id']) if (isset($this->page['comment_on_id']) && $this->page['comment_on_id'])
{ {
$comment_on = $this->load_page('', $this->page['comment_on_id'], '', '', LOAD_ALL); // TODO: LOAD_META only plus 'allow_rawhtml' and 'disable_saf ehtml' $comment_on = $this->load_page('', $this->page['comment_on_id'], '', '', LOAD_ALL); // TODO: LOAD_META only plus 'allow_rawhtml' and 'disable_saf ehtml'
// formatter needs these values from parent page // formatter needs these values from parent page
$this->db->allow_rawhtml = $comment_on['allow_rawhtml']; $this->db->allow_rawhtml = $comment_on['allow_rawhtml'];
$this->db->disable_safehtml = $comment_on['disable_safehtml'] ; $this->db->disable_safehtml = $comment_on['disable_safehtml'] ;
skipping to change at line 86 skipping to change at line 87
$log->l_page = $this->link('/' . $result['tag' ]); $log->l_page = $this->link('/' . $result['tag' ]);
} }
} }
$message = Ut::perc_replace($this->_t('SimilarPagesExists'), '<co de>' . $this->tag . '</code>') . '<br>' . $log; $message = Ut::perc_replace($this->_t('SimilarPagesExists'), '<co de>' . $this->tag . '</code>') . '<br>' . $log;
$tpl->message = $this->show_message($message, 'notice', false); $tpl->message = $this->show_message($message, 'notice', false);
} }
if (isset($_POST)) if (isset($_POST))
{ {
$_body = $_POST['body'] ?? ''; $_body = $_POST['body'] ?? '';
$section = (int) ($_POST['section'] ?? 0);
// watch page // watch page
if ($this->page if ($this->page
&& isset($_POST['watchpage']) && isset($_POST['watchpage'])
&& !isset($_POST['noid_publication']) && !isset($_POST['noid_publication'])
&& $user && $user
&& !$this->is_watched) && !$this->is_watched)
{ {
$this->set_watch($user['user_id'], $this->page['page_id'] ); $this->set_watch($user['user_id'], $this->page['page_id'] );
$this->is_watched = true; $this->is_watched = true;
} }
// only if saving: // only if saving:
if (isset($_POST['save']) && !empty($_POST['body'])) if (isset($_POST['save']) && !empty($_POST['body']))
{ {
$edit_note = trim( ($_POST['edit_note'] ?? '')); $edit_note = trim( ($_POST['edit_note'] ?? ''));
$minor_edit = (int) ($_POST['minor_edit'] ?? 0); $minor_edit = (int) ($_POST['minor_edit'] ?? 0);
$reviewed = (int) ($_POST['reviewed'] ? ? 0); $reviewed = (int) ($_POST['reviewed'] ? ? 0);
$title = trim( ($_POST['title'] ?
? $this->page['title'])); if ($section)
{
$title = trim($this->page['title']);
$sec_title = trim(($_POST['title'] ?? $this-
>page['title']));
}
else
{
$title = trim(($_POST['title'] ?? $this-
>page['title']));
}
// check for reserved word // check for reserved word
if ($result = $this->validate_reserved_words($this->tag)) if ($result = $this->validate_reserved_words($this->tag))
{ {
$message = $result; $message = $result;
$this->set_message($message , 'error'); $this->set_message($message , 'error');
$error = true; $error = true;
} }
// check for overwriting // check for overwriting
if ($this->page && $this->page['modified'] != $_POST['pre vious']) if ($this->page && $this->page['modified'] != $_POST['pre vious'])
{ {
$this->http->status(409); $this->http->status(409);
$this->set_message($this->_t('OverwriteAlert'), ' error'); $this->set_message($this->_t('OverwriteAlert'), ' error');
$error = true; $error = true;
} }
// check text length // check text length
/* if ($textchars > $maxchars) /* if ($text_chars > $max_chars)
{ {
$message = Ut::perc_replace($this->_t('TextDBOver size'), $textchars - $maxchars) . ' '; $message = Ut::perc_replace($this->_t('TextDBOver size'), $text_chars - $max_chars) . ' ';
$this->set_message($message , 'error'); $this->set_message($message , 'error');
$error = true; $error = true;
} */ } */
// check for edit note // check for edit note
if (($this->db->edit_summary == 2) && $_POST['edit_note'] == '' && $this->page['comment_on_id'] == 0) if (($this->db->edit_summary == 2) && $_POST['edit_note'] == '' && $this->page['comment_on_id'] == 0)
{ {
$this->set_message($this->_t('EditNoteMissing'), 'error'); $this->set_message($this->_t('EditNoteMissing'), 'error');
$error = true; $error = true;
} }
skipping to change at line 181 skipping to change at line 192
if (!$error) if (!$error)
{ {
// publish anonymously // publish anonymously
if (isset($_POST['noid_publication']) && $_POST[' noid_publication'] == $this->page['page_id']) if (isset($_POST['noid_publication']) && $_POST[' noid_publication'] == $this->page['page_id'])
{ {
// undefine username // undefine username
$remember_name = $this->get_user_name(); $remember_name = $this->get_user_name();
$this->set_user_setting('user_name', null ); $this->set_user_setting('user_name', null );
} }
// update section
if ($this->db->section_edit && $section)
{
$body = $this->replace_section($this->pag
e['body'], $section, ['title' => $sec_title, 'body' => $body]);
}
// add page (revisions) // add page (revisions)
$body_r = $this->save_page($this->tag, $body, $ti tle, $edit_note, $minor_edit, $reviewed, ($this->page['comment_on_id'] ?? null)) ; $body_r = $this->save_page($this->tag, $body, $ti tle, $edit_note, $minor_edit, $reviewed, ($this->page['comment_on_id'] ?? null)) ;
// new page created // new page created
if (!$this->page) if (!$this->page)
{ {
// this is a new page, get page_id via ta g for the new created page // this is a new page, get page_id via ta g for the new created page
$this->page['page_id'] = $this->get_page_ id($this->tag); $this->page['page_id'] = $this->get_page_ id($this->tag);
// save categories // save categories
skipping to change at line 229 skipping to change at line 246
} }
} }
// saving blank document // saving blank document
else if (isset($_POST['body']) && $_POST['body'] == '') else if (isset($_POST['body']) && $_POST['body'] == '')
{ {
$this->set_message($this->_t('EmptyPage'), 'error'); $this->set_message($this->_t('EmptyPage'), 'error');
$this->http->redirect($this->href()); $this->http->redirect($this->href());
} }
} }
// is section?
if ($this->db->section_edit && isset($_GET['section']))
{
$section = (int) ($_GET['section'] ?? 0);
}
// section header
if ($this->db->section_edit && $section)
{
$this->set_message(
Ut::perc_replace(
$this->_t('EditSectionHint'),
$section,
$this->compose_link_to_page($this->tag, '', $this
->page['title'], $this->tag)
), 'section-info');
}
// section edit
if ($this->db->section_edit && isset($_GET['section']))
{
$p = $this->extract_sections($this->page['body'], $section,
'get');
// assign section as page body
$this->page['body'] = $p['body'];
$this->page['title'] = $p['title'];
}
// fetch fields // fetch fields
$previous = $_POST['previous'] ?? ($this->page['modified'] ? ? null); $previous = $_POST['previous'] ?? ($this->page['modified'] ? ? null);
$body = $_POST['body'] ?? ($this->page['body'] ?? null); $body = $_POST['body'] ?? ($this->page['body'] ?? null);
$title = $_POST['title'] $title = $_POST['title']
?? $this->page['title'] ?? $this->page['title']
?? (isset($this->sess->title) ?? (!empty($this->sess->title)
? (empty($this->sess->tit ? $this->sess->title
le)
? $this->get_page
_title($this->tag)
: $this->sess->ti
tle)
: $this->get_page_title($ this->tag) : $this->get_page_title($ this->tag)
); );
$section = (int) ($_POST['section'] ?? $secti on);
$edit_note = (string) ($_POST['edit_note'] ?? ''); $edit_note = (string) ($_POST['edit_note'] ?? '');
$minor_edit = (int) ($_POST['minor_edit'] ?? 0); $minor_edit = (int) ($_POST['minor_edit'] ?? 0);
// display form // display form
$tpl->enter('f_'); $tpl->enter('f_');
// "cf" attribute: it is for so called "critical fields" in the form. // "cf" attribute: it is for so called "critical fields" in the form.
// It is used by some javascript code, which is launched onbeforeunload a nd shows a pop-up dialog // It is used by some javascript code, which is launched onbeforeunload a nd shows a pop-up dialog
// "You are going to leave this page, but there are some changes you made but not saved yet." // "You are going to leave this page, but there are some changes you made but not saved yet."
// Is used by this script to determine which changes it needs to monitor. // Is used by this script to determine which changes it needs to monitor.
skipping to change at line 318 skipping to change at line 361
if (isset($this->page['comment_on_id']) && $this->page['comment_on_id']) if (isset($this->page['comment_on_id']) && $this->page['comment_on_id'])
{ {
// comment title // comment title
$tpl->e_title = $title; $tpl->e_title = $title;
$tpl->e_label = $this->_t('AddCommentTitle'); $tpl->e_label = $this->_t('AddCommentTitle');
} }
else if (!$this->page || $this->is_owner() || $this->is_admin()) else if (!$this->page || $this->is_owner() || $this->is_admin())
{ {
// edit page title // edit page title
$tpl->e_title = $title; $tpl->e_title = $title;
$tpl->e_label = $this->_t('MetaTitle'); $tpl->e_label = $section
? $this->_t('SectionHeadline') // Headli
ne (section) or $section_title
: $this->_t('MetaTitle');
} }
else else
{ {
// show page title // show page title
$tpl->r_title = $this->page['title']; $tpl->r_title = $this->page['title'];
} }
$tpl->previous = $previous; // -> [ ' previous | e attr ' ] $tpl->section = $section;
$tpl->previous = $previous; // -> [ ' previous | e attr ' ]
// FIXME: \n gets stripped by assign() function in TemplatestSetter class $tpl->body = Ut::html($body); // -> [ ' body | pre ' ]
, see line 117
// -> workaround: [ ' body | pre ' ]
$tpl->body = Ut::html($body); // -> [ ' body | pre ' ]
if (isset($this->page['comment_on_id']) && !$this->page['comment_on_id']) if (isset($this->page['comment_on_id']) && !$this->page['comment_on_id'])
{ {
// edit note // edit note
if ($this->db->edit_summary) if ($this->db->edit_summary)
{ {
// briefly describe your changes (corrected spelling, fix ed grammar, improved formatting) // briefly describe your changes (corrected spelling, fix ed grammar, improved formatting)
$tpl->n_note = $edit_note; $tpl->n_note = $edit_note;
} }
 End of changes. 11 change blocks. 
20 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)