0eece7df79c5e2c5cba1a528fc6a661716696844
[Packages/TYPO3.CMS.git] / typo3 / sysext / viewpage / view / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Module: View
29 *
30 * Views the webpage
31 *
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 */
34
35 unset($MCONF);
36 require ('conf.php');
37 require ($BACK_PATH.'init.php');
38 //require ($BACK_PATH.'template.php');
39 $BE_USER->modAccess($MCONF,1);
40
41
42
43 /**
44 * Script Class for the Web > View
45 *
46 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
47 * @package TYPO3
48 * @subpackage core
49 */
50 class SC_mod_web_view_index {
51 var $MCONF=array();
52 var $MOD_MENU=array();
53 var $MOD_SETTINGS=array();
54
55 var $perms_clause;
56 var $modTSconfig;
57 var $type;
58 var $pageinfo;
59 var $url;
60 var $id;
61 var $wsInstruction='';
62
63 /**
64 * Initialization of module
65 *
66 * @return void
67 */
68 function init() {
69 $this->MCONF = $GLOBALS['MCONF'];
70 $this->id = intval(t3lib_div::_GP('id'));
71
72 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
73
74 // page/be_user TSconfig settings and blinding of menu-items
75 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
76 $this->type = intval($this->modTSconfig['properties']['type']);
77 }
78
79 /**
80 * Main function
81 *
82 * @return void
83 */
84 function main() {
85
86 // Access check...
87 // The page will show only if there is a valid page and if this page may be viewed by the user
88 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
89 $access = is_array($this->pageinfo) ? 1 : 0;
90 $addCmd='';
91 if ($this->id && $access) {
92 $addCmd = '&ADMCMD_view=1&ADMCMD_editIcons=1'.t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo);
93 }
94
95 $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
96 $dName = t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']) ?
97 t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id)):
98 '';
99
100 // preview of mount pages
101 $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
102 $sys_page->init(FALSE);
103 $mountPointInfo = $sys_page->getMountPointInfo($this->id);
104 if ($mountPointInfo && $mountPointInfo['overlay']) {
105 $this->id = $mountPointInfo['mount_pid'];
106 $addCmd .= '&MP=' . $mountPointInfo['MPvar'];
107 }
108
109 $this->url .= ($dName
110 ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://') . $dName
111 : $GLOBALS['BACK_PATH'] . '..') . '/index.php?id=' . $this->id .
112 ($this->type ? '&type='.$this->type : '') . $addCmd;
113 }
114
115 /**
116 * Redirect URL
117 *
118 * @return void
119 */
120 function printContent() {
121 t3lib_utility_Http::redirect($this->url);
122 }
123 }
124
125
126 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php'])) {
127 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php']);
128 }
129
130
131
132 // Make instance:
133 $SOBE = t3lib_div::makeInstance('SC_mod_web_view_index');
134 $SOBE->init();
135 $SOBE->main();
136 $SOBE->printContent();
137
138 ?>