/[cvs]/nfo/site/htdocs/pages/otd_html1/userinfo.php
ViewVC logotype

Contents of /nfo/site/htdocs/pages/otd_html1/userinfo.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Sun Sep 26 17:26:16 2004 UTC (19 years, 11 months ago) by rabit
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +5 -2 lines
U Added queries.

1 <?php $ID = substr(
2 /*------------------------------------------------------------------------------
3 --- www.netfrag.org
4 --- HTML1: user info page.
5 --------------------------------------------------------------------------------
6 --- rabit, 02:29 05.09.2004
7 ------------------------------------------------------------------------------*/
8 '$Id: userinfo.php,v 1.5 2004/09/10 21:44:17 rabit Exp $'
9 //------------------------------------------------------------------------------
10 , 5, -2);
11 //------------------------------------------------------------------------------
12
13 include('../../inc/common/common.php.inc');
14
15 include('../../inc/otdef/otd_html1/otd_html1.php.inc');
16
17 common_benchmark_addstep('OTD_HTML1 included');
18
19 //------------------------------------------------------------------------------
20
21 function variablebox($varname) {
22
23 global $$varname;
24
25 $arraytext = htmlentities(print_r($$varname, true));
26 $arraytext = str_replace(' ', '&nbsp;', $arraytext);
27 $arraytext = str_replace("Array\n", 'array&nbsp;', $arraytext);
28 $arraytext = str_replace('&nbsp;)', ')', $arraytext);
29 $arraytext = str_replace("\n\n", "\n", $arraytext);
30
31 $len = strlen($arraytext);
32 $oldlen = 0;
33
34 while($len != $oldlen) {
35
36 $oldlen = strlen($arraytext);
37 $arraytext = str_replace("array&nbsp;&nbsp;", 'array&nbsp;', $arraytext);
38 $len = strlen($arraytext);
39
40 }
41
42 otd_html1_codeparagraph('<small><b>$' . $varname . '</b> = ' . trim($arraytext) . '</small>');
43
44 }
45
46 common_benchmark_addstep('functions');
47
48 //------------------------------------------------------------------------------
49
50 common_benchmark_addstep('start');
51
52 otd_html1_pagehead();
53
54 common_benchmark_addstep('head');
55
56 otd_html1_pageheader();
57
58 common_benchmark_addstep('header');
59
60 //----------------------------------------------------------
61
62 otd_html1_pagetitle('CMS test page');
63
64 otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');
65
66 //otd_html1_paragraph('If successful, the result of the query process is shown as a table. If you want to see the complete function response then turn "Debug outputs" on.');
67
68 //----------------------------------------------------------
69
70 $queries = array(
71 'GET COUNT FROM SOURCES',
72 'GET FIELDNAMES FROM SOURCES',
73 'GET name FROM SOURCES',
74 'GET * FROM SOURCES',
75 'GET COUNT FROM contenttypes',
76 'GET FIELDNAMES FROM contenttypes',
77 'GET id, name FROM contenttypes',
78 'GET COUNT FROM languages',
79 'GET FIELDNAMES FROM languages',
80 'GET id, name FROM languages',
81 'GET * FROM languages',
82 'GET COUNT FROM contents',
83 'GET FIELDNAMES FROM contents',
84 'GET type, language_id, description FROM contents',
85 'GET id, keyname, description FROM contents WITH type xmlpage',
86 'GET id, description FROM contents WITH language_id 2',
87 'GET id, description FROM contents WITH type xmlpage ORDERBY id COUNT 5',
88 /*
89 'GET content FROM contents WITH id 3',
90 'GET FROM contents WITH timestamp >1000000000',
91 'GET description, language_id FROM contents WITH keyname Home',
92 */
93 );
94
95 $query = (isset($_POST['q']) ? $_POST['q'] : '');
96
97 otd_html1_headline('Query command:');
98
99 for($q = 0, $options = ''; $q < count($queries); $q++)
100 $options .= '<option' . ($query == $queries[$q] ? ' selected="selected"' : '') . ' value="' . $queries[$q] . '">' . $queries[$q] . '</option>
101 ';
102
103 otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
104 <select name="q" size="1">
105 ' . $options . '</select>
106 <input type="submit" value="OK" />
107 </form>', 'box1');
108
109 otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
110 <input name="q" size="76" value="' . $query . '" />
111 <input type="submit" value="OK" />
112 </form>', 'box1');
113
114 common_benchmark_addstep('content');
115
116 if($query) {
117
118 $response = null;
119 $success = cms_query($query, $response);
120
121 common_benchmark_addstep('CMS query');
122
123 otd_html1_headline('Query execution response:');
124
125 otd_html1_paragraph('Command: "<b>' . $query . '</b>"', 'hl12');
126
127 $resultinfo = $response[0];
128
129 otd_html1_paragraph('Error: "<code>' . $resultinfo['error'] . '</code>" - "<b>' . $resultinfo['errortext'] . '</b>"', ($resultinfo['error'] ? 'hl11' : 'hl12'));
130
131 // otd_html1_headline('Result:');
132
133 if($success) {
134
135 switch($resultinfo['operation']) {
136
137 case 'GET':
138
139 $rows = $response[1];
140
141 for($y = 0; $y < count($rows); $y++) {
142
143 for($x = 0; $x < count($rows[$y]); $x++) {
144
145 if(strlen($rows[$y][$x]) > 97) {
146
147 $rows[$y][$x] = substr($rows[$y][$x], 0, 97) . '...';
148
149 }
150
151 $rows[$y][$x] = htmlentities($rows[$y][$x]);
152
153 }
154
155 }
156
157 otd_html1_table($response[2], $rows);
158
159 break;
160
161 }
162
163 } else {
164
165 otd_html1_paragraph('(No result returned)');
166
167 }
168
169 if($common_sessiondata['user_prefs']['debug']) variablebox('response');
170
171 } else {
172
173 otd_html1_headline('Query execution');
174
175 otd_html1_paragraph('Select a pre-defined query string from the list or enter a new one into the text input field. Press the "<b>GO</b>" button in both cases to execute the query.');
176
177 }
178
179 common_benchmark_addstep('content');
180
181 //----------------------------------------------------------
182
183 $extrapageinfocontents = 'Page created by <b>rabit</b> on <b>2004/09/05, 02:29</b>.';
184
185 otd_html1_pagefooter($extrapageinfocontents);
186
187 common_benchmark_addstep('footer');
188
189 otd_html1_pagefoot();
190
191 //------------------------------------------------------------------------------
192
193 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed