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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide 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 rabit 1.1 <?php $ID = substr(
2     /*------------------------------------------------------------------------------
3     --- www.netfrag.org
4     --- HTML1: user info page.
5     --------------------------------------------------------------------------------
6     --- rabit, 02:29 05.09.2004
7     ------------------------------------------------------------------------------*/
8 rabit 1.6 '$Id: userinfo.php,v 1.5 2004/09/10 21:44:17 rabit Exp $'
9 rabit 1.1 //------------------------------------------------------------------------------
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 rabit 1.2 //------------------------------------------------------------------------------
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 rabit 1.5 otd_html1_codeparagraph('<small><b>$' . $varname . '</b> = ' . trim($arraytext) . '</small>');
43 rabit 1.2
44     }
45    
46     common_benchmark_addstep('functions');
47 rabit 1.1
48     //------------------------------------------------------------------------------
49    
50 rabit 1.2 common_benchmark_addstep('start');
51    
52 rabit 1.1 otd_html1_pagehead();
53    
54     common_benchmark_addstep('head');
55    
56     otd_html1_pageheader();
57    
58     common_benchmark_addstep('header');
59    
60     //----------------------------------------------------------
61    
62 rabit 1.3 otd_html1_pagetitle('CMS test page');
63 rabit 1.2
64 rabit 1.4 otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');
65 rabit 1.2
66 rabit 1.5 //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 rabit 1.2
68     //----------------------------------------------------------
69    
70 rabit 1.4 $queries = array(
71 rabit 1.5 '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 rabit 1.6 '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 rabit 1.5 /*
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 rabit 1.4 );
94    
95     $query = (isset($_POST['q']) ? $_POST['q'] : '');
96 rabit 1.2
97 rabit 1.4 otd_html1_headline('Query command:');
98 rabit 1.2
99 rabit 1.5 for($q = 0, $options = ''; $q < count($queries); $q++)
100     $options .= '<option' . ($query == $queries[$q] ? ' selected="selected"' : '') . ' value="' . $queries[$q] . '">' . $queries[$q] . '</option>
101 rabit 1.4 ';
102 rabit 1.2
103 rabit 1.4 otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
104 rabit 1.5 <select name="q" size="1">
105 rabit 1.4 ' . $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 rabit 1.6 <input name="q" size="76" value="' . $query . '" />
111 rabit 1.4 <input type="submit" value="OK" />
112     </form>', 'box1');
113 rabit 1.2
114 rabit 1.4 common_benchmark_addstep('content');
115 rabit 1.2
116 rabit 1.4 if($query) {
117 rabit 1.2
118 rabit 1.4 $response = null;
119     $success = cms_query($query, $response);
120 rabit 1.2
121 rabit 1.4 common_benchmark_addstep('CMS query');
122 rabit 1.1
123 rabit 1.5 otd_html1_headline('Query execution response:');
124 rabit 1.1
125 rabit 1.5 otd_html1_paragraph('Command: "<b>' . $query . '</b>"', 'hl12');
126 rabit 1.1
127 rabit 1.4 $resultinfo = $response[0];
128 rabit 1.1
129 rabit 1.5 otd_html1_paragraph('Error: "<code>' . $resultinfo['error'] . '</code>" - "<b>' . $resultinfo['errortext'] . '</b>"', ($resultinfo['error'] ? 'hl11' : 'hl12'));
130 rabit 1.2
131 rabit 1.5 // otd_html1_headline('Result:');
132 rabit 1.2
133 rabit 1.5 if($success) {
134 rabit 1.1
135 rabit 1.4 switch($resultinfo['operation']) {
136 rabit 1.1
137 rabit 1.4 case 'GET':
138 rabit 1.2
139 rabit 1.4 $rows = $response[1];
140 rabit 1.2
141 rabit 1.4 for($y = 0; $y < count($rows); $y++) {
142 rabit 1.2
143 rabit 1.4 for($x = 0; $x < count($rows[$y]); $x++) {
144 rabit 1.2
145 rabit 1.5 if(strlen($rows[$y][$x]) > 97) {
146 rabit 1.2
147 rabit 1.5 $rows[$y][$x] = substr($rows[$y][$x], 0, 97) . '...';
148 rabit 1.2
149 rabit 1.5 }
150 rabit 1.2
151 rabit 1.5 $rows[$y][$x] = htmlentities($rows[$y][$x]);
152 rabit 1.1
153 rabit 1.4 }
154 rabit 1.2
155 rabit 1.4 }
156 rabit 1.2
157 rabit 1.4 otd_html1_table($response[2], $rows);
158 rabit 1.2
159 rabit 1.4 break;
160 rabit 1.2
161 rabit 1.4 }
162 rabit 1.5
163     } else {
164    
165     otd_html1_paragraph('(No result returned)');
166 rabit 1.2
167 rabit 1.4 }
168 rabit 1.2
169 rabit 1.4 if($common_sessiondata['user_prefs']['debug']) variablebox('response');
170 rabit 1.2
171 rabit 1.4 } else {
172 rabit 1.2
173 rabit 1.4 otd_html1_headline('Query execution');
174 rabit 1.2
175 rabit 1.4 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 rabit 1.2
177     }
178    
179     common_benchmark_addstep('content');
180    
181     //----------------------------------------------------------
182    
183 rabit 1.1 $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