tiki  21.2
About: Tiki Wiki is a Groupware/CMS (Content Management System) solution that has features like Wikis, Forums, Blogs, Articles, Image Gallery, Map Server, Link Directory, Multilingual Support, Bug Tracker, RSS Feeds etc. Latest release 21 with Long Term Support (LTS).
  Fossies Dox: tiki-21.2.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

editmode.php
Go to the documentation of this file.
1 <?php
2 // (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3 //
4 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
5 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6 // $Id$
7 
8 if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) != false) {
9  header('location: index.php');
10  exit;
11 }
13 
14 if (! isset($is_html)) {
15  if (isset($info['is_html'])) {
16  $is_html = $info['is_html'];
17  } else {
18  $is_html = false;
19  }
20 }
21 if ($prefs['feature_wysiwyg'] == 'y' && $prefs['javascript_enabled'] == 'y') {
22  if ($prefs['wysiwyg_optional'] == 'n') {
23  $_SESSION['wysiwyg'] = 'y';
24  } else {
25  if (isset($_REQUEST['mode_wysiwyg']) && $_REQUEST['mode_wysiwyg'] == 'y') {
26  $_SESSION['wysiwyg'] = 'y';
27  } elseif (isset($_REQUEST['mode_normal']) && $_REQUEST['mode_normal'] == 'y') {
28  $_SESSION['wysiwyg'] = 'n';
29  } elseif (isset($_REQUEST['wysiwyg'])) {
30  if (! in_array($_REQUEST['wysiwyg'], ['y', 'n'])) {
31  throw new Exception('Invalid wysiwyg parameter');
32  }
33  $_SESSION['wysiwyg'] = $_REQUEST['wysiwyg'];
34  } elseif ($prefs['wysiwyg_memo'] == 'y' and ! empty($info['wysiwyg'])) {
35  $_SESSION['wysiwyg'] = $info['wysiwyg'];
36  } else {
37  $_SESSION['wysiwyg'] = $prefs['wysiwyg_default'];
38  }
39  }
40 } else {
41  $_SESSION['wysiwyg'] = 'n';
42 }
43 
44 
45 if ($_SESSION['wysiwyg'] == 'y') {
46  if ($prefs['wysiwyg_htmltowiki'] !== 'y' && ! isset($info['is_html'])) { // new pages in wysiwyg mode
47  $is_html = true;
48  }
49  if ($is_html) {
50  $prefs['feature_wiki_allowhtml'] = 'y'; // FIXME: hack. If page is HTML, temporarily allow html even if pref disables it.
51  }
52 } elseif ($prefs['feature_wiki_allowhtml'] == 'y' and ($tiki_p_admin == 'y' or $tiki_p_use_HTML == 'y')) {
53  if (isset($_REQUEST['preview']) || isset($jitRequest['edit'])) {
54  if (isset($_REQUEST["allowhtml"]) && $_REQUEST["allowhtml"] == "on") {
55  $is_html = true;
56  } elseif ($_SESSION['wysiwyg'] === 'n' || $prefs['wysiwyg_htmltowiki'] === 'y') { // unchecked
57  $is_html = false;
58  }
59  } else {
60  if (isset($info['is_html']) and $info['is_html']) {
61  $is_html = true;
62  }
63  }
64 }
65 if (isset($jitRequest['edit'])) {
66  // Restore the property for the rest of the script
67  if ($is_html) {
68  $data = $jitRequest->edit->none();
69  $parserlib = TikiLib::lib('parser');
70  $noparsed = [];
71  $parserlib->plugins_remove($data, $noparsed);
72 
73  $data = TikiFilter::get('xss')->filter($data);
74 
75  $parserlib->plugins_replace($data, $noparsed, true);
76  $_REQUEST['edit'] = $data;
77  } else {
78  $_REQUEST['edit'] = $jitRequest->edit->wikicontent();
79  }
80 
81  //html is stored encoded in wysiwyg
82  if (isset($jitRequest['wysiwyg']) && $jitRequest['wysiwyg'] == 'y') {
83  $_REQUEST['edit'] = html_entity_decode($_REQUEST['edit'], ENT_QUOTES, 'UTF-8');
84  }
85 }
$is_html
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $is_html
Definition: editmode.php:12
$_SESSION
$_SESSION["install-logged-$multi"]
Definition: tiki-installer.php:735
TikiLib\lib
static lib($name)
Definition: tikilib.php:53
or
elseif
if(isset($_GET['msg'])) elseif(isset( $_SESSION[ 'msg']))
Definition: tiki-setup.php:370
$_REQUEST
$_REQUEST["fgal_podcast_dir"]
Definition: include_fgal.php:25
php
$data
$data
Definition: banner_image.php:47
$jitRequest
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $jitRequest
Definition: editmode.php:12
$info
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $info
Definition: editmode.php:12
$parserlib
$parserlib
Definition: include_profiles.php:18
$_SERVER
$_SERVER
Definition: tiki-installer.php:705
exit
exit
Definition: reindex_file.php:61
$tiki_p_admin
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $tiki_p_admin
Definition: editmode.php:8
TikiFilter\get
static get($filter)
Definition: TikiFilter.php:28
$tiki_p_use_HTML
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $tiki_p_use_HTML
Definition: editmode.php:12
$prefs
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $prefs
Definition: editmode.php:12