root / src / phpMyEditSetup.php @ a9b72d88
Historique | Voir | Annoter | Télécharger (20,3 ko)
1 | 1a2be799 | Florent Chuffart | <?php
|
---|---|---|---|
2 | 1a2be799 | Florent Chuffart | |
3 | 1a2be799 | Florent Chuffart | /*
|
4 | 1a2be799 | Florent Chuffart | * phpMyEdit - instant MySQL table editor and code generator
|
5 | 1a2be799 | Florent Chuffart | *
|
6 | 1a2be799 | Florent Chuffart | * phpMyEditSetup.php - interactive table configuration utility (setup)
|
7 | 1a2be799 | Florent Chuffart | * ____________________________________________________________
|
8 | 1a2be799 | Florent Chuffart | *
|
9 | 1a2be799 | Florent Chuffart | * Copyright (c) 1999-2002 John McCreesh <jpmcc@users.sourceforge.net>
|
10 | 1a2be799 | Florent Chuffart | * Copyright (c) 2001-2002 Jim Kraai <jkraai@users.sourceforge.net>
|
11 | 1a2be799 | Florent Chuffart | * Versions 5.0 and higher developed by Ondrej Jombik <nepto@php.net>
|
12 | 1a2be799 | Florent Chuffart | * Copyright (c) 2002-2006 Platon Group, http://platon.sk/
|
13 | 1a2be799 | Florent Chuffart | * All rights reserved.
|
14 | 1a2be799 | Florent Chuffart | *
|
15 | 1a2be799 | Florent Chuffart | * See README file for more information about this software.
|
16 | 1a2be799 | Florent Chuffart | * See COPYING file for license information.
|
17 | 1a2be799 | Florent Chuffart | *
|
18 | 1a2be799 | Florent Chuffart | * Download the latest version from
|
19 | 1a2be799 | Florent Chuffart | * http://platon.sk/projects/phpMyEdit/
|
20 | 1a2be799 | Florent Chuffart | */
|
21 | 1a2be799 | Florent Chuffart | |
22 | 1a2be799 | Florent Chuffart | /* $Platon: phpMyEdit/phpMyEditSetup.php,v 1.50 2007-09-16 12:57:07 nepto Exp $ */
|
23 | 1a2be799 | Florent Chuffart | |
24 | 1a2be799 | Florent Chuffart | ?>
|
25 | 1a2be799 | Florent Chuffart | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
26 | 1a2be799 | Florent Chuffart | "http://www.w3.org/TR/html4/loose.dtd">
|
27 | 1a2be799 | Florent Chuffart | <html>
|
28 | 1a2be799 | Florent Chuffart | <head>
|
29 | 1a2be799 | Florent Chuffart | <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
30 | 1a2be799 | Florent Chuffart | <title>phpMyEdit Setup</title> |
31 | 1a2be799 | Florent Chuffart | <style type="text/css"> |
32 | 1a2be799 | Florent Chuffart | <!--
|
33 | 1a2be799 | Florent Chuffart | body { font-family: "Verdana", "Arial", "Sans-Serif"; text-align: left }
|
34 | 1a2be799 | Florent Chuffart | h1 { color: #004d9c; font-size: 13pt; font-weight: bold }
|
35 | 1a2be799 | Florent Chuffart | h2 { color: #004d9c; font-size: 11pt; font-weight: bold }
|
36 | 1a2be799 | Florent Chuffart | h3 { color: #004d9c; font-size: 11pt; }
|
37 | 1a2be799 | Florent Chuffart | p { color: #004d9c; font-size: 9pt; }
|
38 | 1a2be799 | Florent Chuffart | table { border: 1px solid #004d9c; border-collapse: collapse; border-spacing: 0px; }
|
39 | 1a2be799 | Florent Chuffart | td { border: 1px solid; padding: 3px; color: #004d9c; font-size: 9pt; }
|
40 | 1a2be799 | Florent Chuffart | hr
|
41 | 1a2be799 | Florent Chuffart | {
|
42 | 1a2be799 | Florent Chuffart | height: 1px;
|
43 | 1a2be799 | Florent Chuffart | background-color: #000000;
|
44 | 1a2be799 | Florent Chuffart | color: #000000;
|
45 | 1a2be799 | Florent Chuffart | border: solid #000000 0;
|
46 | 1a2be799 | Florent Chuffart | padding: 0;
|
47 | 1a2be799 | Florent Chuffart | margin: 0;
|
48 | 1a2be799 | Florent Chuffart | border-top-width: 1px;
|
49 | 1a2be799 | Florent Chuffart | }
|
50 | 1a2be799 | Florent Chuffart | -->
|
51 | 1a2be799 | Florent Chuffart | </style>
|
52 | 1a2be799 | Florent Chuffart | </head>
|
53 | 1a2be799 | Florent Chuffart | <body bgcolor="white"> |
54 | 1a2be799 | Florent Chuffart | |
55 | 1a2be799 | Florent Chuffart | <?php
|
56 | 1a2be799 | Florent Chuffart | |
57 | 1a2be799 | Florent Chuffart | if (! defined('PHP_EOL')) { |
58 | 1a2be799 | Florent Chuffart | define('PHP_EOL', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? "\r\n" |
59 | 1a2be799 | Florent Chuffart | : strtoupper(substr(PHP_OS, 0, 3) == 'MAC') ? "\r" : "\n"); |
60 | 1a2be799 | Florent Chuffart | } |
61 | 1a2be799 | Florent Chuffart | |
62 | 1a2be799 | Florent Chuffart | $hn = @$_POST['hn']; |
63 | 1a2be799 | Florent Chuffart | $un = @$_POST['un']; |
64 | 1a2be799 | Florent Chuffart | $pw = @$_POST['pw']; |
65 | 1a2be799 | Florent Chuffart | if(strlen($_POST['db'])>0) $db = @$_POST['db']; |
66 | 1a2be799 | Florent Chuffart | if(strlen($_POST['tb'])>0) $tb = @$_POST['tb']; |
67 | 1a2be799 | Florent Chuffart | $id = @$_POST['id']; |
68 | 1a2be799 | Florent Chuffart | $submit = @$_POST['submit']; |
69 | 1a2be799 | Florent Chuffart | $options = @$_POST['options']; |
70 | 1a2be799 | Florent Chuffart | $baseFilename = @$_POST['baseFilename']; |
71 | 1a2be799 | Florent Chuffart | $pageTitle = @$_POST['pageTitle']; |
72 | 1a2be799 | Florent Chuffart | $pageHeader = @$_POST['pageHeader']; |
73 | 1a2be799 | Florent Chuffart | $HTMLissues = @$_POST['HTMLissues']; |
74 | 1a2be799 | Florent Chuffart | $CSSstylesheet = @$_POST['CSSstylesheet']; |
75 | 1a2be799 | Florent Chuffart | |
76 | 1a2be799 | Florent Chuffart | $phpExtension = '.php'; |
77 | 1a2be799 | Florent Chuffart | if (isset($baseFilename) && $baseFilename != '') { |
78 | 1a2be799 | Florent Chuffart | $phpFile = $baseFilename.$phpExtension; |
79 | 1a2be799 | Florent Chuffart | //$contentFile = $baseFilename.'Content.inc';
|
80 | 1a2be799 | Florent Chuffart | $contentFile = $baseFilename.'.php'; |
81 | 1a2be799 | Florent Chuffart | } elseif (isset($tb)) { |
82 | 1a2be799 | Florent Chuffart | $phpFile = $tb.$phpExtension; |
83 | 1a2be799 | Florent Chuffart | //$contentFile = $tb.'Content.inc';
|
84 | 1a2be799 | Florent Chuffart | $contentFile = $tb.'.php'; |
85 | 1a2be799 | Florent Chuffart | } else {
|
86 | 1a2be799 | Florent Chuffart | $phpFile = 'index'.$phpExtension; |
87 | 1a2be799 | Florent Chuffart | //$contentFile = 'Content.inc';
|
88 | 1a2be799 | Florent Chuffart | $contentFile = 'phpMyEdit-content.php'; |
89 | 1a2be799 | Florent Chuffart | } |
90 | 1a2be799 | Florent Chuffart | |
91 | 1a2be799 | Florent Chuffart | $buffer = ''; |
92 | 1a2be799 | Florent Chuffart | |
93 | 1a2be799 | Florent Chuffart | function echo_html($x) |
94 | 1a2be799 | Florent Chuffart | { |
95 | 1a2be799 | Florent Chuffart | echo htmlspecialchars($x),PHP_EOL; |
96 | 1a2be799 | Florent Chuffart | } |
97 | 1a2be799 | Florent Chuffart | |
98 | 1a2be799 | Florent Chuffart | function echo_buffer($x) |
99 | 1a2be799 | Florent Chuffart | { |
100 | 1a2be799 | Florent Chuffart | global $buffer; |
101 | 1a2be799 | Florent Chuffart | $buffer .= $x.PHP_EOL; |
102 | 1a2be799 | Florent Chuffart | } |
103 | 1a2be799 | Florent Chuffart | |
104 | 1a2be799 | Florent Chuffart | #:#####################################:#
|
105 | 1a2be799 | Florent Chuffart | #:# Function: check_constraints #:#
|
106 | 1a2be799 | Florent Chuffart | #:# Parameters: tb=table name #:#
|
107 | 1a2be799 | Florent Chuffart | #:# fd=field name #:#
|
108 | 1a2be799 | Florent Chuffart | #:# return: lookup default for #:#
|
109 | 1a2be799 | Florent Chuffart | #:# said constraint #:#
|
110 | 1a2be799 | Florent Chuffart | #:# or null if no #:#
|
111 | 1a2be799 | Florent Chuffart | #:# constraint is found. #:#
|
112 | 1a2be799 | Florent Chuffart | #:# Contributed by Wade Ryan, #:#
|
113 | 1a2be799 | Florent Chuffart | #:# 20060906 #:#
|
114 | 1a2be799 | Florent Chuffart | #:#####################################:#
|
115 | 1a2be799 | Florent Chuffart | function check_constraints($tb,$fd) |
116 | 1a2be799 | Florent Chuffart | { |
117 | 1a2be799 | Florent Chuffart | $query = "show create table $tb"; |
118 | 1a2be799 | Florent Chuffart | $result = mysql_query($query); |
119 | 1a2be799 | Florent Chuffart | $tableDef = preg_split('/\n/',mysql_result($result,0,1)); |
120 | 1a2be799 | Florent Chuffart | |
121 | 1a2be799 | Florent Chuffart | $constraint_arg=""; |
122 | 1a2be799 | Florent Chuffart | while (list($key,$val) = each($tableDef)) { |
123 | 1a2be799 | Florent Chuffart | $words=preg_split("/[\s'`()]+/", $val); |
124 | 1a2be799 | Florent Chuffart | if ($words[1] == "CONSTRAINT" && $words[6]=="REFERENCES") { |
125 | 1a2be799 | Florent Chuffart | if ($words[5]==$fd) { |
126 | 1a2be799 | Florent Chuffart | $constraint_arg=" 'values' => array(\n". |
127 | 1a2be799 | Florent Chuffart | " 'table' => '$words[7]',\n".
|
128 | 1a2be799 | Florent Chuffart | " 'column' => '$words[8]'\n".
|
129 | 1a2be799 | Florent Chuffart | " ),\n";
|
130 | 1a2be799 | Florent Chuffart | } |
131 | 1a2be799 | Florent Chuffart | |
132 | 1a2be799 | Florent Chuffart | } |
133 | 1a2be799 | Florent Chuffart | } |
134 | 1a2be799 | Florent Chuffart | return $constraint_arg; |
135 | 1a2be799 | Florent Chuffart | } |
136 | 1a2be799 | Florent Chuffart | |
137 | 1a2be799 | Florent Chuffart | function get_versions() |
138 | 1a2be799 | Florent Chuffart | { |
139 | 1a2be799 | Florent Chuffart | $ret_ar = array(); |
140 | 1a2be799 | Florent Chuffart | $dirname = dirname(__FILE__); |
141 | 1a2be799 | Florent Chuffart | foreach (array( |
142 | 1a2be799 | Florent Chuffart | 'current' => __FILE__, |
143 | 1a2be799 | Florent Chuffart | 'setup' => "$dirname/phpMyEditSetup.php", |
144 | 1a2be799 | Florent Chuffart | 'core' => "$dirname/phpMyEdit.class.php", |
145 | 1a2be799 | Florent Chuffart | 'version' => "$dirname/doc/VERSION") |
146 | 1a2be799 | Florent Chuffart | as $type => $file) { |
147 | 1a2be799 | Florent Chuffart | if (@file_exists($file) && @is_readable($file)) { |
148 | 1a2be799 | Florent Chuffart | if (($f = fopen($file, 'r')) == false) { |
149 | 1a2be799 | Florent Chuffart | continue;
|
150 | 1a2be799 | Florent Chuffart | } |
151 | 1a2be799 | Florent Chuffart | $str = trim(fread($f, 4096)); |
152 | 1a2be799 | Florent Chuffart | if (strpos($str, ' ') === false && strlen($str) < 10) { |
153 | 1a2be799 | Florent Chuffart | $ret_ar[$type] = $str; |
154 | 1a2be799 | Florent Chuffart | } else if (preg_match('|\$'.'Platon:\s+\S+,v\s+(\d+.\d+)\s+|', $str, $matches)) { |
155 | 1a2be799 | Florent Chuffart | $ret_ar[$type] = $matches[1]; |
156 | 1a2be799 | Florent Chuffart | } |
157 | 1a2be799 | Florent Chuffart | fclose($f); |
158 | 1a2be799 | Florent Chuffart | } |
159 | 1a2be799 | Florent Chuffart | } |
160 | 1a2be799 | Florent Chuffart | return $ret_ar; |
161 | 1a2be799 | Florent Chuffart | } |
162 | 1a2be799 | Florent Chuffart | |
163 | 1a2be799 | Florent Chuffart | |
164 | 1a2be799 | Florent Chuffart | $self = basename($_SERVER['PHP_SELF']); |
165 | 1a2be799 | Florent Chuffart | $dbl = @mysql_pconnect($hn, $un, $pw); |
166 | 1a2be799 | Florent Chuffart | |
167 | 1a2be799 | Florent Chuffart | if ((!$dbl) or empty($submit)) { |
168 | 1a2be799 | Florent Chuffart | echo '<h1>Please log in to your MySQL database</h1>'; |
169 | 1a2be799 | Florent Chuffart | if (!empty($submit)) { |
170 | 1a2be799 | Florent Chuffart | echo '<h2>Sorry - login failed - please try again</h2>'.PHP_EOL; |
171 | 1a2be799 | Florent Chuffart | } |
172 | 1a2be799 | Florent Chuffart | if (! isset($hn)) { |
173 | 1a2be799 | Florent Chuffart | $hn = 'localhost'; |
174 | 1a2be799 | Florent Chuffart | } |
175 | 1a2be799 | Florent Chuffart | echo ' |
176 | 1a2be799 | Florent Chuffart | <form action="'.htmlspecialchars($self).'" method="POST"> |
177 | 1a2be799 | Florent Chuffart | <table border="1" cellpadding="1" cellspacing="0" summary="Login form">
|
178 | 1a2be799 | Florent Chuffart | <tr>
|
179 | 1a2be799 | Florent Chuffart | <td>Hostname:</td>
|
180 | 1a2be799 | Florent Chuffart | <td><input type="text" name="hn" value="'.htmlspecialchars($hn).'"></td> |
181 | 1a2be799 | Florent Chuffart | </tr><tr>
|
182 | 1a2be799 | Florent Chuffart | <td>Username:</td>
|
183 | 1a2be799 | Florent Chuffart | <td><input type="text" name="un" value="'.htmlspecialchars($un).'"></td> |
184 | 1a2be799 | Florent Chuffart | </tr><tr>
|
185 | 1a2be799 | Florent Chuffart | <td>Password:</td>
|
186 | 1a2be799 | Florent Chuffart | <td><input type="password" name="pw" value="'.htmlspecialchars($pw).'"></td> |
187 | 1a2be799 | Florent Chuffart | </tr><tr>
|
188 | 1a2be799 | Florent Chuffart | <td>Database:</td>
|
189 | 1a2be799 | Florent Chuffart | <td><input type="text" name="db" value="'.htmlspecialchars($db).'"></td> |
190 | 1a2be799 | Florent Chuffart | </tr><tr>
|
191 | 1a2be799 | Florent Chuffart | <td>Table:</td>
|
192 | 1a2be799 | Florent Chuffart | <td><input type="text" name="tb" value="'.htmlspecialchars($tb).'"></td> |
193 | 1a2be799 | Florent Chuffart | </tr>
|
194 | 1a2be799 | Florent Chuffart | </table><br>
|
195 | 1a2be799 | Florent Chuffart | <input type="submit" name="submit" value="Submit">
|
196 | 1a2be799 | Florent Chuffart | </form>'.PHP_EOL; |
197 | 1a2be799 | Florent Chuffart | } else if (! isset($db)) { |
198 | 1a2be799 | Florent Chuffart | $dbs = @mysql_list_dbs($dbl); |
199 | 1a2be799 | Florent Chuffart | $num_dbs = @mysql_num_rows($dbs); |
200 | 1a2be799 | Florent Chuffart | echo '<h1>Please select a database</h1> |
201 | 1a2be799 | Florent Chuffart | <form action="'.htmlspecialchars($self).'" method="POST"> |
202 | 1a2be799 | Florent Chuffart | <input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
203 | 1a2be799 | Florent Chuffart | <input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
204 | 1a2be799 | Florent Chuffart | <input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
205 | 1a2be799 | Florent Chuffart | <table border="1" cellpadding="1" cellspacing="1" summary="Database selection">'.PHP_EOL; |
206 | 1a2be799 | Florent Chuffart | for ($i = 0; $i < $num_dbs; $i++) { |
207 | 1a2be799 | Florent Chuffart | $db = @mysql_db_name($dbs, $i); |
208 | 1a2be799 | Florent Chuffart | $checked = ! strcasecmp($un, $db) ? ' checked' : ''; |
209 | 1a2be799 | Florent Chuffart | $db = htmlspecialchars($db); |
210 | 1a2be799 | Florent Chuffart | echo '<tr><td><input'.$checked.' type="radio" name="db" value="'.$db.'"></td><td>'.$db.'</td></tr>'.PHP_EOL; |
211 | 1a2be799 | Florent Chuffart | } |
212 | 1a2be799 | Florent Chuffart | echo '</table><br> |
213 | 1a2be799 | Florent Chuffart | <input type="submit" name="submit" value="Submit">
|
214 | 1a2be799 | Florent Chuffart | <input type="submit" name="cancel" value="Cancel">
|
215 | 1a2be799 | Florent Chuffart | </form>'.PHP_EOL; |
216 | 1a2be799 | Florent Chuffart | } else if (!isset($tb)) { |
217 | 1a2be799 | Florent Chuffart | echo '<h1>Please select a table from database: '.htmlspecialchars($db).'</h1> |
218 | 1a2be799 | Florent Chuffart | <form action="'.htmlspecialchars($self).'" method="POST"> |
219 | 1a2be799 | Florent Chuffart | <input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
220 | 1a2be799 | Florent Chuffart | <input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
221 | 1a2be799 | Florent Chuffart | <input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
222 | 1a2be799 | Florent Chuffart | <input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
223 | 1a2be799 | Florent Chuffart | <table border="1" cellpadding="1" cellspacing="1" summary="Table selection">'.PHP_EOL; |
224 | 1a2be799 | Florent Chuffart | $tbs = @mysql_list_tables($db, $dbl); |
225 | 1a2be799 | Florent Chuffart | $num_tbs = @mysql_num_rows($tbs); |
226 | 1a2be799 | Florent Chuffart | for ($j = 0; $j < $num_tbs; $j++) { |
227 | 1a2be799 | Florent Chuffart | $tb = @mysql_tablename($tbs, $j); |
228 | 1a2be799 | Florent Chuffart | $tb = htmlspecialchars($tb); |
229 | 1a2be799 | Florent Chuffart | $checked = $j == 0 ? ' checked' : ''; |
230 | 1a2be799 | Florent Chuffart | echo '<tr><td><input'.$checked.' type="radio" name="tb" value="'.$tb.'"></td><td>'.$tb.'</td></tr>'.PHP_EOL; |
231 | 1a2be799 | Florent Chuffart | } |
232 | 1a2be799 | Florent Chuffart | echo '</table><br> |
233 | 1a2be799 | Florent Chuffart | <input type="submit" name="submit" value="Submit">
|
234 | 1a2be799 | Florent Chuffart | <input type="submit" name="cancel" value="Cancel">
|
235 | 1a2be799 | Florent Chuffart | </form>'.PHP_EOL; |
236 | 1a2be799 | Florent Chuffart | } else if (!isset($id)) { |
237 | 1a2be799 | Florent Chuffart | echo ' <h1>Please select an identifier from table: '.htmlspecialchars($tb).'</h1> |
238 | 1a2be799 | Florent Chuffart | <p>
|
239 | 1a2be799 | Florent Chuffart | This field will be used in change, view, copy and delete operations.<br>
|
240 | 1a2be799 | Florent Chuffart | The field should be numeric and must uniquely identify a record.
|
241 | 1a2be799 | Florent Chuffart | </p>
|
242 | 1a2be799 | Florent Chuffart | <p>
|
243 | 1a2be799 | Florent Chuffart | Please note, that there were problems reported by phpMyEdit users
|
244 | 1a2be799 | Florent Chuffart | regarding using MySQL reserved word as unique key name (the example for
|
245 | 1a2be799 | Florent Chuffart | this is "key" name). Thus we recommend you to use another name
|
246 | 1a2be799 | Florent Chuffart | of unique key. Usage of "id" or "ID" should be safe and good idea.
|
247 | 1a2be799 | Florent Chuffart | </p>
|
248 | 1a2be799 | Florent Chuffart | <form action="'.htmlspecialchars($self).'" method="POST"> |
249 | 1a2be799 | Florent Chuffart | <input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
250 | 1a2be799 | Florent Chuffart | <input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
251 | 1a2be799 | Florent Chuffart | <input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
252 | 1a2be799 | Florent Chuffart | <input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
253 | 1a2be799 | Florent Chuffart | <input type="hidden" name="tb" value="'.htmlspecialchars($tb).'"> |
254 | 1a2be799 | Florent Chuffart | <table border="1" cellpadding="1" cellspacing="1" summary="Key selection">'.PHP_EOL; |
255 | 1a2be799 | Florent Chuffart | // <tr><td><input type="radio" name="id" value="">
|
256 | 1a2be799 | Florent Chuffart | // <td><i>None</i></td><td><i>No id field required</i></td></tr>
|
257 | 1a2be799 | Florent Chuffart | @mysql_select_db($db); |
258 | 1a2be799 | Florent Chuffart | $tb_desc = @mysql_query("DESCRIBE $tb"); |
259 | 1a2be799 | Florent Chuffart | $fds = @mysql_list_fields($db,$tb,$dbl); |
260 | 1a2be799 | Florent Chuffart | for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != false; $j++) { |
261 | 1a2be799 | Florent Chuffart | $ff = @mysql_field_flags($fds, $j); |
262 | 1a2be799 | Florent Chuffart | strlen($ff) <= 0 && $ff = '---'; |
263 | 1a2be799 | Florent Chuffart | $checked = stristr($ff, 'primary_key') ? ' checked' : ''; |
264 | 1a2be799 | Florent Chuffart | echo '<tr><td><input',$checked,' type="radio" name="id" value="',htmlspecialchars($fd),'"></td>'; |
265 | 1a2be799 | Florent Chuffart | echo '<td>',htmlspecialchars($fd),'</td>'; |
266 | 1a2be799 | Florent Chuffart | echo '<td>',htmlspecialchars($ff),'</td>'; |
267 | 1a2be799 | Florent Chuffart | $r = @mysql_fetch_array($tb_desc, $j); |
268 | 1a2be799 | Florent Chuffart | } |
269 | 1a2be799 | Florent Chuffart | echo '</table><br> |
270 | 1a2be799 | Florent Chuffart | <input type="submit" name="submit" value="Submit">
|
271 | 1a2be799 | Florent Chuffart | <input type="submit" name="cancel" value="Cancel">
|
272 | 1a2be799 | Florent Chuffart | </form>'.PHP_EOL; |
273 | 1a2be799 | Florent Chuffart | |
274 | 1a2be799 | Florent Chuffart | } else if (!isset($options)) { |
275 | 1a2be799 | Florent Chuffart | echo '<h1>Please select additional options</h1> |
276 | 1a2be799 | Florent Chuffart | <form action="'.htmlspecialchars($self).'" method="POST"> |
277 | 1a2be799 | Florent Chuffart | <input type="hidden" name="hn" value="'.htmlspecialchars($hn).'"> |
278 | 1a2be799 | Florent Chuffart | <input type="hidden" name="un" value="'.htmlspecialchars($un).'"> |
279 | 1a2be799 | Florent Chuffart | <input type="hidden" name="pw" value="'.htmlspecialchars($pw).'"> |
280 | 1a2be799 | Florent Chuffart | <input type="hidden" name="db" value="'.htmlspecialchars($db).'"> |
281 | 1a2be799 | Florent Chuffart | <input type="hidden" name="tb" value="'.htmlspecialchars($tb).'"> |
282 | 1a2be799 | Florent Chuffart | <input type="hidden" name="id" value="'.htmlspecialchars($id).'"> |
283 | 1a2be799 | Florent Chuffart | <table border="1" cellpadding="1" cellspacing="1" summary="Additional options">
|
284 | 1a2be799 | Florent Chuffart | <tr><td>Base filename</td><td><input type="text" name=baseFilename value ="'.htmlspecialchars($tb).'"></td></tr> |
285 | 1a2be799 | Florent Chuffart | <tr><td>Page title</td><td><input type="text" name=pageTitle value ="'.htmlspecialchars($tb).'"></td></tr> |
286 | 1a2be799 | Florent Chuffart | <tr><td>Page header</td><td><input type="checkbox" name=pageHeader></td></tr>
|
287 | 1a2be799 | Florent Chuffart | <tr><td>HTML header & footer</td><td><input type="checkbox" name=HTMLissues></td></tr>
|
288 | 1a2be799 | Florent Chuffart | <tr><td>CSS basic stylesheet</td><td><input checked type="checkbox" name=CSSstylesheet></td></tr>
|
289 | 1a2be799 | Florent Chuffart | </table><br>
|
290 | 1a2be799 | Florent Chuffart | <input type="submit" name="submit" value="Submit">
|
291 | 1a2be799 | Florent Chuffart | <input type="submit" name="cancel" value="Cancel">
|
292 | 1a2be799 | Florent Chuffart | <input type="hidden" name="options" value="1">
|
293 | 1a2be799 | Florent Chuffart | </form>'.PHP_EOL; |
294 | 1a2be799 | Florent Chuffart | } else {
|
295 | 1a2be799 | Florent Chuffart | echo '<h1>Here is your phpMyEdit calling program</h1>'.PHP_EOL; |
296 | 1a2be799 | Florent Chuffart | echo '<h2>You may now copy and paste it into your PHP editor</h2>'.PHP_EOL; |
297 | 1a2be799 | Florent Chuffart | if ($pageHeader) { |
298 | 1a2be799 | Florent Chuffart | echo_buffer('<h3>'.$pageTitle.'</h3>'); |
299 | 1a2be799 | Florent Chuffart | } |
300 | 1a2be799 | Florent Chuffart | $versions = ''; |
301 | 1a2be799 | Florent Chuffart | $versions_ar = get_versions();
|
302 | 1a2be799 | Florent Chuffart | foreach (array( |
303 | 1a2be799 | Florent Chuffart | 'version' => 'phpMyEdit version:', |
304 | 1a2be799 | Florent Chuffart | 'core' => 'phpMyEdit.class.php core class:', |
305 | 1a2be799 | Florent Chuffart | 'setup' => 'phpMyEditSetup.php script:', |
306 | 1a2be799 | Florent Chuffart | 'current' => 'generating setup script:') |
307 | 1a2be799 | Florent Chuffart | as $type => $desc) { |
308 | 1a2be799 | Florent Chuffart | $version = isset($versions_ar[$type]) ? $versions_ar[$type] : 'unknown'; |
309 | 1a2be799 | Florent Chuffart | $versions .= sprintf("\n * %36s %s", $desc, $version); |
310 | 1a2be799 | Florent Chuffart | } |
311 | 1a2be799 | Florent Chuffart | echo_buffer("<?php
|
312 | 1a2be799 | Florent Chuffart |
|
313 | 1a2be799 | Florent Chuffart | /*
|
314 | 1a2be799 | Florent Chuffart | * IMPORTANT NOTE: This generated file contains only a subset of huge amount
|
315 | 1a2be799 | Florent Chuffart | * of options that can be used with phpMyEdit. To get information about all
|
316 | 1a2be799 | Florent Chuffart | * features offered by phpMyEdit, check official documentation. It is available
|
317 | 1a2be799 | Florent Chuffart | * online and also for download on phpMyEdit project management page:
|
318 | 1a2be799 | Florent Chuffart | *
|
319 | 1a2be799 | Florent Chuffart | * http://platon.sk/projects/main_page.php?project_id=5
|
320 | 1a2be799 | Florent Chuffart | *
|
321 | 1a2be799 | Florent Chuffart | * This file was generated by:
|
322 | 1a2be799 | Florent Chuffart | *$versions
|
323 | 1a2be799 | Florent Chuffart | */
|
324 | 1a2be799 | Florent Chuffart |
|
325 | 1a2be799 | Florent Chuffart | // MySQL host name, user name, password, database, and table
|
326 | 1a2be799 | Florent Chuffart | \$opts['hn'] = '$hn';
|
327 | 1a2be799 | Florent Chuffart | \$opts['un'] = '$un';
|
328 | 1a2be799 | Florent Chuffart | \$opts['pw'] = '$pw';
|
329 | 1a2be799 | Florent Chuffart | \$opts['db'] = '$db';
|
330 | 1a2be799 | Florent Chuffart | \$opts['tb'] = '$tb';
|
331 | 1a2be799 | Florent Chuffart |
|
332 | 1a2be799 | Florent Chuffart | // Name of field which is the unique key
|
333 | 1a2be799 | Florent Chuffart | \$opts['key'] = '$id';
|
334 | 1a2be799 | Florent Chuffart |
|
335 | 1a2be799 | Florent Chuffart | // Type of key field (int/real/string/date etc.)");
|
336 | 1a2be799 | Florent Chuffart | |
337 | 1a2be799 | Florent Chuffart | if ($id == '') { |
338 | 1a2be799 | Florent Chuffart | echo_buffer("\$opts['key_type'] = '';");
|
339 | 1a2be799 | Florent Chuffart | } else {
|
340 | 1a2be799 | Florent Chuffart | $fds = @mysql_list_fields($db,$tb,$dbl); |
341 | 1a2be799 | Florent Chuffart | for ($j = 0; ($fd = @mysql_field_name($fds, $j)) != ''; $j++) { |
342 | 1a2be799 | Florent Chuffart | if ($fd == $id) { |
343 | 1a2be799 | Florent Chuffart | echo_buffer("\$opts['key_type'] = '".@mysql_field_type($fds, $j)."';"); |
344 | 1a2be799 | Florent Chuffart | break;
|
345 | 1a2be799 | Florent Chuffart | } |
346 | 1a2be799 | Florent Chuffart | } |
347 | 1a2be799 | Florent Chuffart | } |
348 | 1a2be799 | Florent Chuffart | echo_buffer("
|
349 | 1a2be799 | Florent Chuffart | // Sorting field(s)
|
350 | 1a2be799 | Florent Chuffart | \$opts['sort_field'] = array('$id');
|
351 | 1a2be799 | Florent Chuffart |
|
352 | 1a2be799 | Florent Chuffart | // Number of records to display on the screen
|
353 | 1a2be799 | Florent Chuffart | // Value of -1 lists all records in a table
|
354 | 1a2be799 | Florent Chuffart | \$opts['inc'] = 15;
|
355 | 1a2be799 | Florent Chuffart |
|
356 | 1a2be799 | Florent Chuffart | // Options you wish to give the users
|
357 | 1a2be799 | Florent Chuffart | // A - add, C - change, P - copy, V - view, D - delete,
|
358 | 1a2be799 | Florent Chuffart | // F - filter, I - initial sort suppressed
|
359 | 1a2be799 | Florent Chuffart | \$opts['options'] = 'ACPVDF';
|
360 | 1a2be799 | Florent Chuffart |
|
361 | 1a2be799 | Florent Chuffart | // Number of lines to display on multiple selection filters
|
362 | 1a2be799 | Florent Chuffart | \$opts['multiple'] = '4';
|
363 | 1a2be799 | Florent Chuffart |
|
364 | 1a2be799 | Florent Chuffart | // Navigation style: B - buttons (default), T - text links, G - graphic links
|
365 | 1a2be799 | Florent Chuffart | // Buttons position: U - up, D - down (default)
|
366 | 1a2be799 | Florent Chuffart | \$opts['navigation'] = 'DB';
|
367 | 1a2be799 | Florent Chuffart |
|
368 | 1a2be799 | Florent Chuffart | // Display special page elements
|
369 | 1a2be799 | Florent Chuffart | \$opts['display'] = array(
|
370 | 1a2be799 | Florent Chuffart | 'form' => true,
|
371 | 1a2be799 | Florent Chuffart | 'query' => true,
|
372 | 1a2be799 | Florent Chuffart | 'sort' => true,
|
373 | 1a2be799 | Florent Chuffart | 'time' => true,
|
374 | 1a2be799 | Florent Chuffart | 'tabs' => true
|
375 | 1a2be799 | Florent Chuffart | );
|
376 | 1a2be799 | Florent Chuffart |
|
377 | 1a2be799 | Florent Chuffart | // Set default prefixes for variables
|
378 | 1a2be799 | Florent Chuffart | \$opts['js']['prefix'] = 'PME_js_';
|
379 | 1a2be799 | Florent Chuffart | \$opts['dhtml']['prefix'] = 'PME_dhtml_';
|
380 | 1a2be799 | Florent Chuffart | \$opts['cgi']['prefix']['operation'] = 'PME_op_';
|
381 | 1a2be799 | Florent Chuffart | \$opts['cgi']['prefix']['sys'] = 'PME_sys_';
|
382 | 1a2be799 | Florent Chuffart | \$opts['cgi']['prefix']['data'] = 'PME_data_';
|
383 | 1a2be799 | Florent Chuffart |
|
384 | 1a2be799 | Florent Chuffart | /* Get the user's default language and use it if possible or you can
|
385 | 1a2be799 | Florent Chuffart | specify particular one you want to use. Refer to official documentation
|
386 | 1a2be799 | Florent Chuffart | for list of available languages. */
|
387 | 1a2be799 | Florent Chuffart | \$opts['language'] = \$_SERVER['HTTP_ACCEPT_LANGUAGE'] . '-UTF8';
|
388 | 1a2be799 | Florent Chuffart |
|
389 | 1a2be799 | Florent Chuffart | /* Table-level filter capability. If set, it is included in the WHERE clause
|
390 | 1a2be799 | Florent Chuffart | of any generated SELECT statement in SQL query. This gives you ability to
|
391 | 1a2be799 | Florent Chuffart | work only with subset of data from table.
|
392 | 1a2be799 | Florent Chuffart |
|
393 | 1a2be799 | Florent Chuffart | \$opts['filters'] = \"column1 like '%11%' AND column2<17\";
|
394 | 1a2be799 | Florent Chuffart | \$opts['filters'] = \"section_id = 9\";
|
395 | 1a2be799 | Florent Chuffart | \$opts['filters'] = \"PMEtable0.sessions_count > 200\";
|
396 | 1a2be799 | Florent Chuffart | */
|
397 | 1a2be799 | Florent Chuffart |
|
398 | 1a2be799 | Florent Chuffart | /* Field definitions
|
399 | 1a2be799 | Florent Chuffart |
|
400 | 1a2be799 | Florent Chuffart | Fields will be displayed left to right on the screen in the order in which they
|
401 | 1a2be799 | Florent Chuffart | appear in generated list. Here are some most used field options documented.
|
402 | 1a2be799 | Florent Chuffart |
|
403 | 1a2be799 | Florent Chuffart | ['name'] is the title used for column headings, etc.;
|
404 | 1a2be799 | Florent Chuffart | ['maxlen'] maximum length to display add/edit/search input boxes
|
405 | 1a2be799 | Florent Chuffart | ['trimlen'] maximum length of string content to display in row listing
|
406 | 1a2be799 | Florent Chuffart | ['width'] is an optional display width specification for the column
|
407 | 1a2be799 | Florent Chuffart | e.g. ['width'] = '100px';
|
408 | 1a2be799 | Florent Chuffart | ['mask'] a string that is used by sprintf() to format field output
|
409 | 1a2be799 | Florent Chuffart | ['sort'] true or false; means the users may sort the display on this column
|
410 | 1a2be799 | Florent Chuffart | ['strip_tags'] true or false; whether to strip tags from content
|
411 | 1a2be799 | Florent Chuffart | ['nowrap'] true or false; whether this field should get a NOWRAP
|
412 | 1a2be799 | Florent Chuffart | ['select'] T - text, N - numeric, D - drop-down, M - multiple selection
|
413 | 1a2be799 | Florent Chuffart | ['options'] optional parameter to control whether a field is displayed
|
414 | 1a2be799 | Florent Chuffart | L - list, F - filter, A - add, C - change, P - copy, D - delete, V - view
|
415 | 1a2be799 | Florent Chuffart | Another flags are:
|
416 | 1a2be799 | Florent Chuffart | R - indicates that a field is read only
|
417 | 1a2be799 | Florent Chuffart | W - indicates that a field is a password field
|
418 | 1a2be799 | Florent Chuffart | H - indicates that a field is to be hidden and marked as hidden
|
419 | 1a2be799 | Florent Chuffart | ['URL'] is used to make a field 'clickable' in the display
|
420 | 1a2be799 | Florent Chuffart | e.g.: 'mailto:\$value', 'http://\$value' or '\$page?stuff';
|
421 | 1a2be799 | Florent Chuffart | ['URLtarget'] HTML target link specification (for example: _blank)
|
422 | 1a2be799 | Florent Chuffart | ['textarea']['rows'] and/or ['textarea']['cols']
|
423 | 1a2be799 | Florent Chuffart | specifies a textarea is to be used to give multi-line input
|
424 | 1a2be799 | Florent Chuffart | e.g. ['textarea']['rows'] = 5; ['textarea']['cols'] = 10
|
425 | 1a2be799 | Florent Chuffart | ['values'] restricts user input to the specified constants,
|
426 | 1a2be799 | Florent Chuffart | e.g. ['values'] = array('A','B','C') or ['values'] = range(1,99)
|
427 | 1a2be799 | Florent Chuffart | ['values']['table'] and ['values']['column'] restricts user input
|
428 | 1a2be799 | Florent Chuffart | to the values found in the specified column of another table
|
429 | 1a2be799 | Florent Chuffart | ['values']['description'] = 'desc_column'
|
430 | 1a2be799 | Florent Chuffart | The optional ['values']['description'] field allows the value(s) displayed
|
431 | 1a2be799 | Florent Chuffart | to the user to be different to those in the ['values']['column'] field.
|
432 | 1a2be799 | Florent Chuffart | This is useful for giving more meaning to column values. Multiple
|
433 | 1a2be799 | Florent Chuffart | descriptions fields are also possible. Check documentation for this.
|
434 | 1a2be799 | Florent Chuffart | */
|
435 | 1a2be799 | Florent Chuffart | ");
|
436 | 1a2be799 | Florent Chuffart | |
437 | 1a2be799 | Florent Chuffart | @mysql_select_db($db); |
438 | 1a2be799 | Florent Chuffart | $tb_desc = @mysql_query("DESCRIBE $tb"); |
439 | 1a2be799 | Florent Chuffart | $fds = @mysql_list_fields($db, $tb, $dbl); |
440 | 1a2be799 | Florent Chuffart | $num_fds = @mysql_num_fields($fds); |
441 | 1a2be799 | Florent Chuffart | $ts_cnt = 0; |
442 | 1a2be799 | Florent Chuffart | for ($k = 0; $k < $num_fds; $k++) { |
443 | 1a2be799 | Florent Chuffart | $fd = mysql_field_name($fds,$k); |
444 | 1a2be799 | Florent Chuffart | $fm = mysql_fetch_field($fds,$k); |
445 | 1a2be799 | Florent Chuffart | $fn = strtr($fd, '_-.', ' '); |
446 | 1a2be799 | Florent Chuffart | $fn = preg_replace('/(^| +)id( +|$)/', '\\1ID\\2', $fn); // uppercase IDs |
447 | 1a2be799 | Florent Chuffart | $fn = ucfirst($fn); |
448 | 1a2be799 | Florent Chuffart | $row = @mysql_fetch_array($tb_desc); |
449 | 1a2be799 | Florent Chuffart | echo_buffer('$opts[\'fdd\'][\''.$fd.'\'] = array('); // ) |
450 | 1a2be799 | Florent Chuffart | echo_buffer(" 'name' => '".str_replace('\'','\\\'',$fn)."',"); |
451 | 1a2be799 | Florent Chuffart | $auto_increment = strstr($row[5], 'auto_increment') ? 1 : 0; |
452 | 1a2be799 | Florent Chuffart | if (substr($row[1],0,3) == 'set') { |
453 | 1a2be799 | Florent Chuffart | echo_buffer(" 'select' => 'M',");
|
454 | 1a2be799 | Florent Chuffart | } else {
|
455 | 1a2be799 | Florent Chuffart | echo_buffer(" 'select' => 'T',");
|
456 | 1a2be799 | Florent Chuffart | } |
457 | 1a2be799 | Florent Chuffart | if ($auto_increment) { |
458 | 1a2be799 | Florent Chuffart | echo_buffer(" 'options' => 'AVCPDR', // auto increment");
|
459 | 1a2be799 | Florent Chuffart | } |
460 | 1a2be799 | Florent Chuffart | // timestamps are read-only
|
461 | 1a2be799 | Florent Chuffart | else if (@mysql_field_type($fds, $k) == 'timestamp') { |
462 | 1a2be799 | Florent Chuffart | if ($ts_cnt > 0) { |
463 | 1a2be799 | Florent Chuffart | echo_buffer(" 'options' => 'AVCPD',");
|
464 | 1a2be799 | Florent Chuffart | } else { // first timestamp |
465 | 1a2be799 | Florent Chuffart | echo_buffer(" 'options' => 'AVCPDR', // updated automatically (MySQL feature)");
|
466 | 1a2be799 | Florent Chuffart | } |
467 | 1a2be799 | Florent Chuffart | $ts_cnt++;
|
468 | 1a2be799 | Florent Chuffart | } |
469 | 1a2be799 | Florent Chuffart | echo_buffer(" 'maxlen' => ".@mysql_field_len($fds,$k).','); |
470 | 1a2be799 | Florent Chuffart | // blobs -> textarea
|
471 | 1a2be799 | Florent Chuffart | if (@mysql_field_type($fds,$k) == 'blob') { |
472 | 1a2be799 | Florent Chuffart | echo_buffer(" 'textarea' => array(");
|
473 | 1a2be799 | Florent Chuffart | echo_buffer(" 'rows' => 5,");
|
474 | 1a2be799 | Florent Chuffart | echo_buffer(" 'cols' => 50),");
|
475 | 1a2be799 | Florent Chuffart | } |
476 | 1a2be799 | Florent Chuffart | // SETs and ENUMs get special treatment
|
477 | 1a2be799 | Florent Chuffart | if ((substr($row[1],0,3) == 'set' || substr($row[1],0,4) == 'enum') |
478 | 1a2be799 | Florent Chuffart | && ! (($pos = strpos($row[1], '(')) === false)) { |
479 | 1a2be799 | Florent Chuffart | $indent = str_repeat(' ', 18); |
480 | 1a2be799 | Florent Chuffart | $outstr = substr($row[1], $pos + 2, -2); |
481 | 1a2be799 | Florent Chuffart | $outstr = explode("','", $outstr); |
482 | 1a2be799 | Florent Chuffart | $outstr = str_replace("''", "'", $outstr); |
483 | 1a2be799 | Florent Chuffart | $outstr = str_replace('"', '\\"', $outstr); |
484 | 1a2be799 | Florent Chuffart | $outstr = implode('",'.PHP_EOL.$indent.'"', $outstr); |
485 | 1a2be799 | Florent Chuffart | echo_buffer(" 'values' => array(".PHP_EOL.$indent.'"'.$outstr.'"),'); |
486 | 1a2be799 | Florent Chuffart | } |
487 | 1a2be799 | Florent Chuffart | // automatic support for Default values
|
488 | 1a2be799 | Florent Chuffart | if ($row[4] != '' && $row[4] != 'NULL') { |
489 | 1a2be799 | Florent Chuffart | echo_buffer(" 'default' => '".$row[4]."',"); |
490 | 1a2be799 | Florent Chuffart | } else if ($auto_increment) { |
491 | 1a2be799 | Florent Chuffart | echo_buffer(" 'default' => '0',");
|
492 | 1a2be799 | Florent Chuffart | } |
493 | 1a2be799 | Florent Chuffart | // check for table constraints
|
494 | 1a2be799 | Florent Chuffart | $outstr = check_constraints($tb, $fd); |
495 | 1a2be799 | Florent Chuffart | if ($outstr != '') { |
496 | 1a2be799 | Florent Chuffart | echo_buffer($outstr);
|
497 | 1a2be799 | Florent Chuffart | } |
498 | 1a2be799 | Florent Chuffart | echo_buffer(" 'sort' => true");
|
499 | 1a2be799 | Florent Chuffart | //echo_buffer(" 'nowrap' => false,");
|
500 | 1a2be799 | Florent Chuffart | echo_buffer(');');
|
501 | 1a2be799 | Florent Chuffart | } |
502 | 1a2be799 | Florent Chuffart | |
503 | 1a2be799 | Florent Chuffart | echo_buffer("
|
504 | 1a2be799 | Florent Chuffart | // Now important call to phpMyEdit
|
505 | 1a2be799 | Florent Chuffart | require_once 'phpMyEdit.class.php';
|
506 | 1a2be799 | Florent Chuffart | new phpMyEdit(\$opts);
|
507 | 1a2be799 | Florent Chuffart |
|
508 | 1a2be799 | Florent Chuffart | ?>
|
509 | 1a2be799 | Florent Chuffart | ");
|
510 | 1a2be799 | Florent Chuffart | |
511 | 1a2be799 | Florent Chuffart | $css_directive = <<<END |
512 | 1a2be799 | Florent Chuffart | <style type="text/css">
|
513 | 1a2be799 | Florent Chuffart | hr.pme-hr { border: 0px solid; padding: 0px; margin: 0px; border-top-width: 1px; height: 1px; }
|
514 | 1a2be799 | Florent Chuffart | table.pme-main { border: #004d9c 1px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
|
515 | 1a2be799 | Florent Chuffart | table.pme-navigation { border: #004d9c 0px solid; border-collapse: collapse; border-spacing: 0px; width: 100%; }
|
516 | 1a2be799 | Florent Chuffart | td.pme-navigation-0, td.pme-navigation-1 { white-space: nowrap; }
|
517 | 1a2be799 | Florent Chuffart | th.pme-header { border: #004d9c 1px solid; padding: 4px; background: #add8e6; }
|
518 | 1a2be799 | Florent Chuffart | td.pme-key-0, td.pme-value-0, td.pme-help-0, td.pme-navigation-0, td.pme-cell-0,
|
519 | 1a2be799 | Florent Chuffart | td.pme-key-1, td.pme-value-1, td.pme-help-0, td.pme-navigation-1, td.pme-cell-1,
|
520 | 1a2be799 | Florent Chuffart | td.pme-sortinfo, td.pme-filter { border: #004d9c 1px solid; padding: 3px; }
|
521 | 1a2be799 | Florent Chuffart | td.pme-buttons { text-align: left; }
|
522 | 1a2be799 | Florent Chuffart | td.pme-message { text-align: center; }
|
523 | 1a2be799 | Florent Chuffart | td.pme-stats { text-align: right; }
|
524 | 1a2be799 | Florent Chuffart | </style>
|
525 | 1a2be799 | Florent Chuffart | END;
|
526 | 1a2be799 | Florent Chuffart | if (! $CSSstylesheet) { |
527 | 1a2be799 | Florent Chuffart | $css_directive = ''; |
528 | 1a2be799 | Florent Chuffart | } |
529 | 1a2be799 | Florent Chuffart | |
530 | 1a2be799 | Florent Chuffart | if ($HTMLissues) { |
531 | 1a2be799 | Florent Chuffart | $buffer = <<<END |
532 | 1a2be799 | Florent Chuffart | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
533 | 1a2be799 | Florent Chuffart | "http://www.w3.org/TR/html4/loose.dtd">
|
534 | 1a2be799 | Florent Chuffart | <html>
|
535 | 1a2be799 | Florent Chuffart | <head>
|
536 | 1a2be799 | Florent Chuffart | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
537 | 1a2be799 | Florent Chuffart | <title>$pageTitle</title>
|
538 | 1a2be799 | Florent Chuffart | $css_directive
|
539 | 1a2be799 | Florent Chuffart | </head>
|
540 | 1a2be799 | Florent Chuffart | <body>
|
541 | 1a2be799 | Florent Chuffart | $buffer
|
542 | 1a2be799 | Florent Chuffart | </body>
|
543 | 1a2be799 | Florent Chuffart | </html>
|
544 | 1a2be799 | Florent Chuffart | END;
|
545 | 1a2be799 | Florent Chuffart | } else if ($CSSstylesheet) { |
546 | 1a2be799 | Florent Chuffart | $buffer = $css_directive . $buffer; |
547 | 1a2be799 | Florent Chuffart | } |
548 | 1a2be799 | Florent Chuffart | // write the content include file
|
549 | 1a2be799 | Florent Chuffart | echo 'Trying to write content file to: <b>'.'./'.$contentFile.'</b><br>'.PHP_EOL; |
550 | 1a2be799 | Florent Chuffart | $filehandle = @fopen('./'.$contentFile, 'w+'); |
551 | 1a2be799 | Florent Chuffart | if ($filehandle) { |
552 | 1a2be799 | Florent Chuffart | fwrite($filehandle, $buffer); |
553 | 1a2be799 | Florent Chuffart | flush($filehandle); |
554 | 1a2be799 | Florent Chuffart | fclose($filehandle); |
555 | 1a2be799 | Florent Chuffart | echo 'phpMyEdit content file written successfully<br>'; |
556 | 1a2be799 | Florent Chuffart | } else {
|
557 | 1a2be799 | Florent Chuffart | echo 'phpMyEdit content file was NOT written due to inssufficient privileges.<br>'; |
558 | 1a2be799 | Florent Chuffart | echo 'Please copy and paste content listed below to <i>'.'./'.$contentFile.'</i> file.'; |
559 | 1a2be799 | Florent Chuffart | } |
560 | 1a2be799 | Florent Chuffart | echo '<br><hr>'; |
561 | 1a2be799 | Florent Chuffart | echo '<pre>'; |
562 | 1a2be799 | Florent Chuffart | echo_html($buffer);
|
563 | 1a2be799 | Florent Chuffart | echo '</pre><hr>'.PHP_EOL; |
564 | 1a2be799 | Florent Chuffart | } |
565 | 1a2be799 | Florent Chuffart | |
566 | 1a2be799 | Florent Chuffart | ?>
|
567 | 1a2be799 | Florent Chuffart | |
568 | 1a2be799 | Florent Chuffart | </body>
|
569 | 1a2be799 | Florent Chuffart | </html>
|