Added $Id$ keywords, cleaned up comment tags
[Packages/TYPO3.CMS.git] / typo3 / dev / dump_template_tables.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skårhøj (kasper@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 * Dev-script: Dumps the TypoScrip template tables.
29 *
30 * This script prints out all language-labels in TYPO3 and provides a way of checking for missing translations.
31 * Must be logged in as admin.
32 *
33 * $Id$
34 *
35 * @author Kasper Skårhøj <kasper@typo3.com>
36 * @package TYPO3
37 * @subpackage core
38 */
39
40 die("<strong>This script is for typo3 development and maintenance only. You'll probably find it useless for what you do.</strong><br><br>MUST remove this line in descriptions script before it'll work for you. This is a security precaution. Anyways, you must be logged in as admin as well.");
41
42
43 $BACK_PATH="../";
44 define("TYPO3_MOD_PATH", "dev/");
45 require ($BACK_PATH."init.php");
46
47 if (!$BE_USER->user["admin"]) die("You must be logged in as admin user!");
48
49
50 // ***************************
51 // Registering Incoming data
52 // ***************************
53 t3lib_div::setGPvars("table,uid,hide");
54 //debug($HTTP_POST_VARS);
55
56
57 // ***************************
58 // Functions
59 // ***************************
60 function getTemplateOutput($row) {
61 $title = "TITLE: ".$row["title"]." ";
62 $info = "PID: ".$row["pid"]." UID: ".$row["uid"]." ";
63
64 $out="";
65 $out.="[*******************************************************************]\n";
66 $out.="[*** ".substr($title,0,59)." ***]\n";
67 $out.="[*** ".substr($info,0,59)." ***]\n";
68 $out.="[*******************************************************************]\n";
69 $out.="[*** CONSTANTS ***]\n";
70 $out.="[*******************************************************************]\n";
71
72 $out.=htmlspecialchars($row["constants"]);
73 $out.="\n\n";
74
75 $out.="[*******************************************************************]\n";
76 $out.="[*** SETUP ***]\n";
77 $out.="[*******************************************************************]\n";
78
79 $out.=htmlspecialchars($row["config"]);
80 $out.="\n\n";
81
82 return $out;
83 }
84
85
86
87 // ***************************
88 // Starting document output
89 // ***************************
90
91 if (!$hide) {
92 ?>
93
94 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
95
96 <html>
97 <head>
98 <title>Untitled</title>
99 </head>
100
101 <body>
102
103 <form action="dump_template_tables.php" method="post">
104 Table:
105 <br>
106 <select name="table">
107 <option value="static_template"<?php if($table=="static_template") echo" selected";?>>static_template</option>
108 <option value="sys_template"<?php if($table=="sys_template") echo" selected";?>>sys_template</option>
109 </select><br>
110 Specific Uid: <br>
111 <input type="text" name="uid" size="5"><br>
112 Hide this control:<br>
113 <input type="checkbox" name="hide" value="1"><br>
114 <input type="submit">
115 </form>
116 <hr>
117 <br>
118 <?php
119 }
120
121 if ($table=="sys_template" || $table=="static_template") {
122 $out="";
123 $where = ($table=="sys_template") ? "NOT deleted" : "1=1";
124 if (intval($uid)) $where.=" AND uid=".intval($uid);
125 $query = "SELECT uid,pid,constants,config,title FROM ".$table." WHERE ".$where." ORDER BY title";
126 $res = mysql(TYPO3_db,$query);
127 while($row=mysql_fetch_assoc($res)) {
128 $out.= getTemplateOutput($row);
129 }
130 echo (!$hide?"MD5: ".md5($out):"")."<PRE>
131 ".$out."
132 </PRE>";
133
134 }
135
136
137 if (!$hide) {
138 ?>
139
140
141 </body>
142 </html>
143 <?php
144 }
145 ?>