More workspace stuff for beta.
[Packages/TYPO3.CMS.git] / typo3 / sysext / viewpage / view / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (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 * [CLASS/FUNCTION INDEX of SCRIPT]
36 *
37 *
38 *
39 * 65: class SC_mod_web_view_index
40 * 80: function init()
41 * 97: function main()
42 * 122: function printContent()
43 *
44 * TOTAL FUNCTIONS: 3
45 * (This index is automatically created/updated by the extension "extdeveval")
46 *
47 */
48
49 unset($MCONF);
50 require ('conf.php');
51 require ($BACK_PATH.'init.php');
52 //require ($BACK_PATH.'template.php');
53 require_once (PATH_t3lib.'class.t3lib_page.php');
54 $BE_USER->modAccess($MCONF,1);
55
56
57
58 /**
59 * Script Class for the Web > View
60 *
61 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
62 * @package TYPO3
63 * @subpackage core
64 */
65 class SC_mod_web_view_index {
66 var $MCONF=array();
67 var $MOD_MENU=array();
68 var $MOD_SETTINGS=array();
69
70 var $perms_clause;
71 var $modTSconfig;
72 var $type;
73 var $pageinfo;
74 var $url;
75 var $id;
76 var $wsInstruction='';
77
78 /**
79 * Initialization of module
80 *
81 * @return void
82 */
83 function init() {
84 global $BE_USER;
85
86 $this->MCONF = $GLOBALS['MCONF'];
87 $this->id = intval(t3lib_div::_GP('id'));
88
89 $this->perms_clause = $BE_USER->getPagePermsClause(1);
90
91 // page/be_user TSconfig settings and blinding of menu-items
92 $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']);
93 $this->type = intval($this->modTSconfig['properties']['type']);
94 }
95
96 /**
97 * Main function
98 *
99 * @return void
100 */
101 function main() {
102 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
103
104 // Access check...
105 // The page will show only if there is a valid page and if this page may be viewed by the user
106 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
107 $access = is_array($this->pageinfo) ? 1 : 0;
108 $addCmd='';
109 if ($this->id && $access) {
110 $addCmd = '&ADMCMD_view=1&ADMCMD_editIcons=1'.t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo);
111 }
112
113 $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
114 $dName = t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path']) ?
115 t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id)):
116 '';
117
118 $this->url.= ($dName?(t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').$dName:$BACK_PATH.'..').'/index.php?id='.$this->id.($this->type?'&type='.$this->type:'').$addCmd;
119 //debug($this->url);
120 }
121
122 /**
123 * Redirect URL
124 *
125 * @return void
126 */
127 function printContent() {
128 Header('Location: '.t3lib_div::locationHeaderUrl($this->url));
129 }
130 }
131
132 // Include extension?
133 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php']) {
134 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/viewpage/view/index.php']);
135 }
136
137
138
139
140
141
142
143
144
145
146
147
148 // Make instance:
149 $SOBE = t3lib_div::makeInstance('SC_mod_web_view_index');
150 $SOBE->init();
151 $SOBE->main();
152 $SOBE->printContent();
153 ?>