| 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.2 2004/09/06 00:17:27 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('    ', ' ', $arraytext); | 
| 27 | $arraytext = str_replace("Array\n", 'array ', $arraytext); | 
| 28 | $arraytext = str_replace(' )', ')', $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  ", 'array ', $arraytext); | 
| 38 | $len = strlen($arraytext); | 
| 39 |  | 
| 40 | } | 
| 41 |  | 
| 42 | otd_html1_codeparagraph('<small> | 
| 43 | <b>$' . $varname . '</b> = ' . nl2br($arraytext) . ' | 
| 44 | </small>'); | 
| 45 |  | 
| 46 | } | 
| 47 |  | 
| 48 | common_benchmark_addstep('functions'); | 
| 49 |  | 
| 50 | //------------------------------------------------------------------------------ | 
| 51 |  | 
| 52 | common_benchmark_addstep('start'); | 
| 53 |  | 
| 54 | otd_html1_pagehead(); | 
| 55 |  | 
| 56 | common_benchmark_addstep('head'); | 
| 57 |  | 
| 58 | otd_html1_pageheader(); | 
| 59 |  | 
| 60 | common_benchmark_addstep('header'); | 
| 61 |  | 
| 62 | //---------------------------------------------------------- | 
| 63 |  | 
| 64 | otd_html1_pagetitle('CMS test page'); | 
| 65 |  | 
| 66 | otd_html1_paragraph('This is the first outstanding page and was created for testing.'); | 
| 67 |  | 
| 68 | otd_html1_headline('CMS (Content Management System) test queries:'); | 
| 69 |  | 
| 70 | otd_html1_paragraph('In the following basic CMS queries are tested. Each result list is shown as a table. If you want to see explicit results turn "Debug outputs" on.'); | 
| 71 |  | 
| 72 | common_benchmark_addstep('content'); | 
| 73 |  | 
| 74 | //---------------------------------------------------------- | 
| 75 |  | 
| 76 | $query = 'LIST languages'; | 
| 77 |  | 
| 78 | $response = null; | 
| 79 | $success = cms_query($query, $response); | 
| 80 |  | 
| 81 | common_benchmark_addstep('CMS query'); | 
| 82 |  | 
| 83 | otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":'); | 
| 84 |  | 
| 85 | $idlist = ''; | 
| 86 |  | 
| 87 | for($r = 0; $r < count($response[1]); $r++) | 
| 88 | $idlist .= ($r ? ', ' : '') . $response[1][$r][0]; | 
| 89 |  | 
| 90 | otd_html1_paragraph('List of IDs: "<b>' . $idlist . '</b>"', 'hl12'); | 
| 91 |  | 
| 92 | if($common_sessiondata['user_prefs']['debug']) variablebox('response'); | 
| 93 |  | 
| 94 | common_benchmark_addstep('content'); | 
| 95 |  | 
| 96 | //---------------------------------------------------------- | 
| 97 |  | 
| 98 | $query = 'GET 1, 2 FROM languages'; | 
| 99 |  | 
| 100 | $response = null; | 
| 101 | $success = cms_query($query, $response); | 
| 102 |  | 
| 103 | common_benchmark_addstep('CMS query'); | 
| 104 |  | 
| 105 | otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":'); | 
| 106 |  | 
| 107 | $rows = $response[1]; | 
| 108 |  | 
| 109 | for($y = 0; $y < count($rows); $y++) { | 
| 110 |  | 
| 111 | for($x = 0; $x < count($rows[$y]); $x++) { | 
| 112 |  | 
| 113 | $rows[$y][$x] = htmlentities($rows[$y][$x]); | 
| 114 |  | 
| 115 | } | 
| 116 |  | 
| 117 | } | 
| 118 |  | 
| 119 | otd_html1_table($response[2], $rows); | 
| 120 |  | 
| 121 | if($common_sessiondata['user_prefs']['debug']) variablebox('response'); | 
| 122 |  | 
| 123 | common_benchmark_addstep('content'); | 
| 124 |  | 
| 125 | //---------------------------------------------------------- | 
| 126 |  | 
| 127 | $query = 'LIST contents | 
| 128 | WITH keyname=Home, language_id=2'; | 
| 129 |  | 
| 130 | $response = null; | 
| 131 | $success = cms_query($query, $response); | 
| 132 |  | 
| 133 | common_benchmark_addstep('CMS query'); | 
| 134 |  | 
| 135 | otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":'); | 
| 136 |  | 
| 137 | $idlist = ''; | 
| 138 |  | 
| 139 | for($r = 0; $r < count($response[1]); $r++) | 
| 140 | $idlist .= ($r ? ', ' : '') . $response[1][$r][0]; | 
| 141 |  | 
| 142 | otd_html1_paragraph('List of IDs: "<b>' . $idlist . '</b>"', 'hl12'); | 
| 143 |  | 
| 144 | if($common_sessiondata['user_prefs']['debug']) variablebox('response'); | 
| 145 |  | 
| 146 | common_benchmark_addstep('content'); | 
| 147 |  | 
| 148 | //---------------------------------------------------------- | 
| 149 |  | 
| 150 | $query = 'GET 3 FROM contents'; | 
| 151 |  | 
| 152 | $response = null; | 
| 153 | $success = cms_query($query, $response); | 
| 154 |  | 
| 155 | common_benchmark_addstep('CMS query'); | 
| 156 |  | 
| 157 | otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":'); | 
| 158 |  | 
| 159 | $rows = $response[1]; | 
| 160 |  | 
| 161 | for($y = 0; $y < count($rows); $y++) { | 
| 162 |  | 
| 163 | for($x = 0; $x < count($rows[$y]); $x++) { | 
| 164 |  | 
| 165 | $rows[$y][$x] = htmlentities($rows[$y][$x]); | 
| 166 |  | 
| 167 | } | 
| 168 |  | 
| 169 | $rows[$y][6] = '<small><code>' . substr($rows[$y][6], 0, 64) . '...</code><small>'; | 
| 170 | } | 
| 171 |  | 
| 172 | otd_html1_table($response[2], $rows); | 
| 173 |  | 
| 174 | if($common_sessiondata['user_prefs']['debug']) variablebox('response'); | 
| 175 |  | 
| 176 | common_benchmark_addstep('content'); | 
| 177 |  | 
| 178 | //---------------------------------------------------------- | 
| 179 |  | 
| 180 | $extrapageinfocontents = 'Page created by <b>rabit</b> on <b>2004/09/05, 02:29</b>.'; | 
| 181 |  | 
| 182 | otd_html1_pagefooter($extrapageinfocontents); | 
| 183 |  | 
| 184 | common_benchmark_addstep('footer'); | 
| 185 |  | 
| 186 | otd_html1_pagefoot(); | 
| 187 |  | 
| 188 | //------------------------------------------------------------------------------ | 
| 189 |  | 
| 190 | ?> |