| 16 |  |  | 
| 17 | common_benchmark_addstep('OTD_HTML1 included'); | common_benchmark_addstep('OTD_HTML1 included'); | 
| 18 |  |  | 
| 19 | common_benchmark_addstep('start'); | //------------------------------------------------------------------------------ | 
| 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(); | otd_html1_pagehead(); | 
| 55 |  |  | 
| 56 | common_benchmark_addstep('head'); | common_benchmark_addstep('head'); | 
| 61 |  |  | 
| 62 | //---------------------------------------------------------- | //---------------------------------------------------------- | 
| 63 |  |  | 
| 64 | otd_html1_pagetitle('User info'); | 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 | otd_html1_paragraph('This is an overview of your preferences and informations related to you and your visit. You may also change global settings here.'); | $response = null; | 
| 101 |  | $success = cms_query($query, $response); | 
| 102 |  |  | 
| 103 | otd_html1_paragraph('Also it is the first outstanding page and was created for testing yet.'); | common_benchmark_addstep('CMS query'); | 
| 104 |  |  | 
| 105 | // Only show debug outputs when set as preference: | otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":'); | 
|  | if($common_sessiondata['user_prefs']['debug']) { |  | 
| 106 |  |  | 
| 107 | otd_html1_headline('User preferences array:'); | $rows = $response[1]; | 
| 108 | otd_html1_codeparagraph('$common_sessiondata[user_prefs] = ' . nl2br(htmlentities(print_r($common_sessiondata['user_prefs'], true)))); |  | 
| 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'); | 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>.'; | $extrapageinfocontents = 'Page created by <b>rabit</b> on <b>2004/09/05, 02:29</b>.'; | 
| 181 |  |  | 
| 182 | otd_html1_pagefooter($extrapageinfocontents); | otd_html1_pagefooter($extrapageinfocontents); |