Rev 237 | Rev 250 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
112 | daniel-mar | 20 | if (!defined('IN_OIDPLUS')) die(); |
21 | |||
2 | daniel-mar | 22 | class OIDplusGui { |
23 | |||
24 | private static $crudCounter = 0; |
||
25 | |||
26 | protected static function objDescription($html) { |
||
27 | // We allow HTML, but no hacking |
||
12 | daniel-mar | 28 | $html = anti_xss($html); |
11 | daniel-mar | 29 | |
30 | return trim_br($html); |
||
2 | daniel-mar | 31 | } |
32 | |||
33 | protected static function showCrud($parent='oid:') { |
||
34 | $items_total = 0; |
||
35 | $items_hidden = 0; |
||
36 | |||
37 | $objParent = OIDplusObject::parse($parent); |
||
206 | daniel-mar | 38 | $parentNS = $objParent::ns(); |
2 | daniel-mar | 39 | |
206 | daniel-mar | 40 | $result = OIDplus::db()->query("select o.*, r.ra_name " . |
41 | "from ".OIDPLUS_TABLENAME_PREFIX."objects o " . |
||
42 | "left join ".OIDPLUS_TABLENAME_PREFIX."ra r on r.email = o.ra_email " . |
||
43 | "where parent = ? " . |
||
44 | "order by ".OIDplus::db()->natOrder('id'), array($parent)); |
||
45 | $rows = array(); |
||
46 | if ($parentNS == 'oid') { |
||
47 | $one_weid_available = $objParent->isWeid(true); |
||
236 | daniel-mar | 48 | while ($row = $result->fetch_object()) { |
206 | daniel-mar | 49 | $obj = OIDplusObject::parse($row->id); |
50 | $rows[] = array($obj,$row); |
||
51 | if (!$one_weid_available) { |
||
52 | if ($obj->isWeid(true)) $one_weid_available = true; |
||
53 | } |
||
54 | } |
||
55 | } else { |
||
56 | $one_weid_available = false; |
||
236 | daniel-mar | 57 | while ($row = $result->fetch_object()) { |
206 | daniel-mar | 58 | $obj = OIDplusObject::parse($row->id); |
59 | $rows[] = array($obj,$row); |
||
60 | } |
||
61 | } |
||
62 | |||
2 | daniel-mar | 63 | $output = ''; |
64 | $output .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
65 | $output .= '<table class="table table-bordered table-striped">'; |
||
66 | $output .= ' <tr>'; |
||
206 | daniel-mar | 67 | $output .= ' <th>ID'.(($parentNS == 'gs1') ? ' (without check digit)' : '').'</th>'; |
68 | if ($parentNS == 'oid') { |
||
69 | if ($one_weid_available) $output .= ' <th>WEID</th>'; |
||
196 | daniel-mar | 70 | $output .= ' <th>ASN.1 IDs (comma sep.)</th>'; |
71 | $output .= ' <th>IRI IDs (comma sep.)</th>'; |
||
72 | } |
||
2 | daniel-mar | 73 | $output .= ' <th>RA</th>'; |
204 | daniel-mar | 74 | $output .= ' <th>Comment</th>'; |
2 | daniel-mar | 75 | if ($objParent->userHasWriteRights()) { |
76 | $output .= ' <th>Hide</th>'; |
||
77 | $output .= ' <th>Update</th>'; |
||
78 | $output .= ' <th>Delete</th>'; |
||
79 | } |
||
80 | $output .= ' <th>Created</th>'; |
||
81 | $output .= ' <th>Updated</th>'; |
||
82 | $output .= ' </tr>'; |
||
83 | |||
206 | daniel-mar | 84 | foreach ($rows as list($obj,$row)) { |
2 | daniel-mar | 85 | $items_total++; |
86 | if (!$obj->userHasReadRights()) { |
||
87 | $items_hidden++; |
||
88 | continue; |
||
89 | } |
||
90 | |||
91 | $show_id = $obj->crudShowId($objParent); |
||
92 | |||
93 | $asn1ids = array(); |
||
150 | daniel-mar | 94 | $res2 = OIDplus::db()->query("select name from ".OIDPLUS_TABLENAME_PREFIX."asn1id where oid = ? order by lfd", array($row->id)); |
236 | daniel-mar | 95 | while ($row2 = $res2->fetch_array()) { |
2 | daniel-mar | 96 | $asn1ids[] = $row2['name']; |
97 | } |
||
98 | |||
99 | $iris = array(); |
||
150 | daniel-mar | 100 | $res2 = OIDplus::db()->query("select name from ".OIDPLUS_TABLENAME_PREFIX."iri where oid = ? order by lfd", array($row->id)); |
236 | daniel-mar | 101 | while ($row2 = $res2->fetch_array()) { |
2 | daniel-mar | 102 | $iris[] = $row2['name']; |
103 | } |
||
104 | |||
105 | $output .= '<tr>'; |
||
104 | daniel-mar | 106 | $output .= ' <td><a href="?goto='.urlencode($row->id).'" onclick="openAndSelectNode('.js_escape($row->id).', '.js_escape($parent).'); return false;">'.htmlentities($show_id).'</a></td>'; |
2 | daniel-mar | 107 | if ($objParent->userHasWriteRights()) { |
206 | daniel-mar | 108 | if ($parentNS == 'oid') { |
109 | if ($one_weid_available) { |
||
110 | if ($obj->isWeid(false)) { |
||
111 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
||
112 | } else { |
||
113 | $output .= ' <td>n/a</td>'; |
||
114 | } |
||
196 | daniel-mar | 115 | } |
5 | daniel-mar | 116 | $output .= ' <td><input type="text" id="asn1ids_'.$row->id.'" value="'.implode(', ', $asn1ids).'"></td>'; |
117 | $output .= ' <td><input type="text" id="iris_'.$row->id.'" value="'.implode(', ', $iris).'"></td>'; |
||
118 | } |
||
204 | daniel-mar | 119 | $output .= ' <td><input type="text" id="ra_email_'.$row->id.'" value="'.htmlentities($row->ra_email).'"></td>'; |
120 | $output .= ' <td><input type="text" id="comment_'.$row->id.'" value="'.htmlentities($row->comment).'"></td>'; |
||
2 | daniel-mar | 121 | $output .= ' <td><input type="checkbox" id="hide_'.$row->id.'" '.($row->confidential ? 'checked' : '').'></td>'; |
104 | daniel-mar | 122 | $output .= ' <td><button type="button" name="update_'.$row->id.'" id="update_'.$row->id.'" class="btn btn-success btn-xs update" onclick="crudActionUpdate('.js_escape($row->id).', '.js_escape($parent).')">Update</button></td>'; |
123 | $output .= ' <td><button type="button" name="delete_'.$row->id.'" id="delete_'.$row->id.'" class="btn btn-danger btn-xs delete" onclick="crudActionDelete('.js_escape($row->id).', '.js_escape($parent).')">Delete</button></td>'; |
||
124 | $output .= ' <td>'.oidplus_formatdate($row->created).'</td>'; |
||
125 | $output .= ' <td>'.oidplus_formatdate($row->updated).'</td>'; |
||
2 | daniel-mar | 126 | } else { |
127 | if ($asn1ids == '') $asn1ids = '<i>(none)</i>'; |
||
128 | if ($iris == '') $iris = '<i>(none)</i>'; |
||
206 | daniel-mar | 129 | if ($parentNS == 'oid') { |
130 | if ($one_weid_available) { |
||
131 | if ($obj->isWeid(false)) { |
||
132 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
||
133 | } else { |
||
134 | $output .= ' <td>n/a</td>'; |
||
135 | } |
||
196 | daniel-mar | 136 | } |
5 | daniel-mar | 137 | $asn1ids_ext = array(); |
138 | foreach ($asn1ids as $asn1id) { |
||
104 | daniel-mar | 139 | $asn1ids_ext[] = '<a href="?goto='.urlencode($row->id).'" onclick="openAndSelectNode('.js_escape($row->id).', '.js_escape($parent).'); return false;">'.$asn1id.'</a>'; |
5 | daniel-mar | 140 | } |
141 | $output .= ' <td>'.implode(', ', $asn1ids_ext).'</td>'; |
||
142 | $output .= ' <td>'.implode(', ', $iris).'</td>'; |
||
143 | } |
||
109 | daniel-mar | 144 | $output .= ' <td><a '.oidplus_link('oidplus:rainfo$'.str_replace('@','&',$row->ra_email)).'>'.htmlentities(empty($row->ra_name) ? str_replace('@','&',$row->ra_email) : $row->ra_name).'</a></td>'; |
204 | daniel-mar | 145 | $output .= ' <td>'.htmlentities($row->comment).'</td>'; |
104 | daniel-mar | 146 | $output .= ' <td>'.oidplus_formatdate($row->created).'</td>'; |
147 | $output .= ' <td>'.oidplus_formatdate($row->updated).'</td>'; |
||
2 | daniel-mar | 148 | } |
149 | $output .= '</tr>'; |
||
150 | } |
||
151 | |||
150 | daniel-mar | 152 | $result = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($parent)); |
236 | daniel-mar | 153 | $parent_ra_email = $result->num_rows() > 0 ? $result->fetch_object()->ra_email : ''; |
2 | daniel-mar | 154 | |
155 | if ($objParent->userHasWriteRights()) { |
||
156 | $output .= '<tr>'; |
||
157 | $prefix = is_null($objParent) ? '' : $objParent->crudInsertPrefix(); |
||
206 | daniel-mar | 158 | if ($parentNS == 'oid') { |
199 | daniel-mar | 159 | if ($objParent->isWeid(true)) { |
160 | $output .= ' <td>'.$prefix.' <input oninput="frdl_oidid_change()" type="text" id="id" value="" style="width:100%;min-width:100px"></td>'; // TODO: idee classname vergeben, z.B. "OID" und dann mit einem oid-spezifischen css die breite einstellbar machen, somit hat das plugin mehr kontrolle über das aussehen und die mindestbreiten |
||
161 | $output .= ' <td><input type="text" name="weid" id="weid" value="" oninput="frdl_weid_change()"></td>'; |
||
162 | } else { |
||
163 | $output .= ' <td>'.$prefix.' <input type="text" id="id" value="" style="width:100%;min-width:50px"></td>'; // TODO: idee classname vergeben, z.B. "OID" und dann mit einem oid-spezifischen css die breite einstellbar machen, somit hat das plugin mehr kontrolle über das aussehen und die mindestbreiten |
||
206 | daniel-mar | 164 | if ($one_weid_available) $output .= ' <td></td>'; // WEID-editor not available for root nodes. Do it manually, please |
199 | daniel-mar | 165 | } |
2 | daniel-mar | 166 | } else { |
167 | $output .= ' <td>'.$prefix.' <input type="text" id="id" value=""></td>'; |
||
168 | } |
||
206 | daniel-mar | 169 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="asn1ids" value=""></td>'; |
170 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="iris" value=""></td>'; |
||
2 | daniel-mar | 171 | $output .= ' <td><input type="text" id="ra_email" value="'.htmlentities($parent_ra_email).'"></td>'; |
204 | daniel-mar | 172 | $output .= ' <td><input type="text" id="comment" value=""></td>'; |
2 | daniel-mar | 173 | $output .= ' <td><input type="checkbox" id="hide"></td>'; |
104 | daniel-mar | 174 | $output .= ' <td><button type="button" name="insert" id="insert" class="btn btn-success btn-xs update" onclick="crudActionInsert('.js_escape($parent).')">Insert</button></td>'; |
2 | daniel-mar | 175 | $output .= ' <td></td>'; |
176 | $output .= ' <td></td>'; |
||
177 | $output .= ' <td></td>'; |
||
178 | $output .= '</tr>'; |
||
179 | } else { |
||
180 | if ($items_total-$items_hidden == 0) { |
||
206 | daniel-mar | 181 | $cols = ($parentNS == 'oid') ? 7 : 5; |
182 | if ($one_weid_available) $cols++; |
||
2 | daniel-mar | 183 | $output .= '<tr><td colspan="'.$cols.'">No items available</td></tr>'; |
184 | } |
||
185 | } |
||
186 | |||
187 | $output .= '</table>'; |
||
188 | $output .= '</div></div>'; |
||
189 | |||
190 | if ($items_hidden == 1) { |
||
107 | daniel-mar | 191 | $output .= '<p>'.$items_hidden.' item is hidden. Please <a '.oidplus_link('oidplus:login').'>log in</a> to see it.</p>'; |
2 | daniel-mar | 192 | } else if ($items_hidden > 1) { |
107 | daniel-mar | 193 | $output .= '<p>'.$items_hidden.' items are hidden. Please <a '.oidplus_link('oidplus:login').'>log in</a> to see them.</p>'; |
2 | daniel-mar | 194 | } |
195 | |||
196 | return $output; |
||
197 | } |
||
198 | |||
136 | daniel-mar | 199 | // 'quickbars' added 11 July 2019: Disabled because of two problems: |
200 | // 1. When you load TinyMCE via AJAX using the left menu, the quickbar is immediately shown, even if TinyMCE does not have the focus |
||
201 | // 2. When you load a page without TinyMCE using the left menu, the quickbar is still visible, although there is no edit |
||
236 | daniel-mar | 202 | // 'colorpicker', 'textcolor' and 'contextmenu' added in 07 April 2020, because it is built in in the core. |
203 | public static $exclude_tinymce_plugins = array('fullpage', 'bbcode', 'quickbars', 'colorpicker', 'textcolor', 'contextmenu'); |
||
2 | daniel-mar | 204 | |
205 | protected static function showMCE($name, $content) { |
||
206 | $mce_plugins = array(); |
||
4 | daniel-mar | 207 | foreach (glob(__DIR__ . '/../../3p/tinymce/plugins/*') as $m) { // */ |
2 | daniel-mar | 208 | $mce_plugins[] = basename($m); |
209 | } |
||
210 | |||
211 | foreach (self::$exclude_tinymce_plugins as $exclude) { |
||
212 | $index = array_search($exclude, $mce_plugins); |
||
213 | if ($index !== false) unset($mce_plugins[$index]); |
||
214 | } |
||
215 | |||
4 | daniel-mar | 216 | $out = '<script> |
217 | tinymce.remove("#'.$name.'"); |
||
238 | daniel-mar | 218 | tinymce.EditorManager.baseURL = "3p/tinymce"; |
2 | daniel-mar | 219 | tinymce.init({ |
238 | daniel-mar | 220 | document_base_url: "'.OIDplus::getSystemUrl().'", |
4 | daniel-mar | 221 | selector: "#'.$name.'", |
222 | height: 200, |
||
223 | statusbar: false, |
||
224 | // menubar:false, |
||
225 | // toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table | fontsizeselect", |
||
226 | toolbar: "undo redo | styleselect | bold italic underline forecolor | bullist numlist | outdent indent | table | fontsizeselect", |
||
123 | daniel-mar | 227 | plugins: "'.implode(' ', $mce_plugins).'", |
228 | mobile: { |
||
229 | theme: "mobile", |
||
230 | toolbar: "undo redo | styleselect | bold italic underline forecolor | bullist numlist | outdent indent | table | fontsizeselect", |
||
231 | plugins: "'.implode(' ', $mce_plugins).'" |
||
232 | } |
||
233 | |||
2 | daniel-mar | 234 | }); |
4 | daniel-mar | 235 | </script>'; |
2 | daniel-mar | 236 | |
89 | daniel-mar | 237 | $content = htmlentities($content); // For some reason, if we want to display the text "<xyz>" in TinyMCE, we need to double-encode things! < will not be accepted, we need &lt; ... why? |
238 | |||
4 | daniel-mar | 239 | $out .= '<textarea name="'.htmlentities($name).'" id="'.htmlentities($name).'">'.trim($content).'</textarea><br>'; |
2 | daniel-mar | 240 | |
241 | return $out; |
||
242 | } |
||
243 | |||
244 | public static function generateContentPage($id) { |
||
245 | $out = array(); |
||
246 | |||
247 | $handled = false; |
||
248 | $out['title'] = ''; |
||
32 | daniel-mar | 249 | $out['icon'] = ''; |
2 | daniel-mar | 250 | $out['text'] = ''; |
251 | |||
252 | // === Plugins === |
||
253 | |||
61 | daniel-mar | 254 | foreach (OIDplus::getPagePlugins('*') as $plugin) { |
255 | $plugin->gui($id, $out, $handled); |
||
256 | } |
||
2 | daniel-mar | 257 | |
258 | // === Everything else (objects) === |
||
259 | |||
260 | if (!$handled) { |
||
93 | daniel-mar | 261 | try { |
262 | $obj = OIDplusObject::parse($id); |
||
263 | } catch (Exception $e) { |
||
264 | $out['title'] = 'Error'; |
||
265 | $out['icon'] = 'img/error_big.png'; |
||
266 | $out['text'] = htmlentities($e->getMessage()); |
||
267 | return $out; |
||
268 | } |
||
2 | daniel-mar | 269 | |
270 | if ((!is_null($obj)) && (!$obj->userHasReadRights())) { |
||
271 | $out['title'] = 'Access denied'; |
||
34 | daniel-mar | 272 | $out['icon'] = 'img/error_big.png'; |
107 | daniel-mar | 273 | $out['text'] = '<p>Please <a '.oidplus_link('oidplus:login').'>log in</a> to receive information about this object.</p>'; |
2 | daniel-mar | 274 | return $out; |
275 | } |
||
276 | |||
183 | daniel-mar | 277 | // --- |
2 | daniel-mar | 278 | |
98 | daniel-mar | 279 | $parent = null; |
183 | daniel-mar | 280 | $res = null; |
281 | $row = null; |
||
2 | daniel-mar | 282 | $matches_any_registered_type = false; |
227 | daniel-mar | 283 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
2 | daniel-mar | 284 | if ($obj = $ot::parse($id)) { |
285 | $matches_any_registered_type = true; |
||
183 | daniel-mar | 286 | if ($obj->isRoot()) { |
34 | daniel-mar | 287 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
183 | daniel-mar | 288 | $parent = null; // $obj->getParent(); |
98 | daniel-mar | 289 | break; |
183 | daniel-mar | 290 | } else { |
291 | $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($obj->nodeId())); |
||
236 | daniel-mar | 292 | $row = $res->fetch_array(); |
293 | if ($res->num_rows() == 0) { |
||
183 | daniel-mar | 294 | http_response_code(404); |
295 | $out['title'] = 'Object not found'; |
||
296 | $out['icon'] = 'img/error_big.png'; |
||
297 | $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.'; |
||
298 | return $out; |
||
299 | } else { |
||
300 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
||
227 | daniel-mar | 301 | if (empty($out['title'])) $out['title'] = explode(':',$id,2)[1]; |
183 | daniel-mar | 302 | $parent = $obj->getParent(); |
303 | break; |
||
304 | } |
||
2 | daniel-mar | 305 | } |
306 | } |
||
307 | } |
||
308 | if (!$matches_any_registered_type) { |
||
309 | http_response_code(404); |
||
310 | $out['title'] = 'Object not found'; |
||
34 | daniel-mar | 311 | $out['icon'] = 'img/error_big.png'; |
2 | daniel-mar | 312 | $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.'; |
313 | return $out; |
||
314 | } |
||
315 | |||
183 | daniel-mar | 316 | // --- |
317 | |||
103 | daniel-mar | 318 | if ($parent) { |
319 | if ($parent->isRoot()) { |
||
98 | daniel-mar | 320 | |
321 | $parent_link_text = $parent->objectTypeTitle(); |
||
129 | daniel-mar | 322 | $out['text'] = '<p><a '.oidplus_link($parent->root()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
98 | daniel-mar | 323 | |
324 | } else { |
||
150 | daniel-mar | 325 | $res_ = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($parent->nodeId())); |
236 | daniel-mar | 326 | $row_ = $res_->fetch_array(); |
98 | daniel-mar | 327 | |
328 | $parent_title = $row_['title']; |
||
329 | if (empty($parent_title) && ($parent->ns() == 'oid')) { |
||
150 | daniel-mar | 330 | $res_ = OIDplus::db()->query("select name from ".OIDPLUS_TABLENAME_PREFIX."asn1id where oid = ?", array($parent->nodeId())); |
236 | daniel-mar | 331 | $row_ = $res_->fetch_array(); |
98 | daniel-mar | 332 | $parent_title = $row_['name']; // TODO: multiple ASN1 ids? |
333 | } |
||
334 | |||
335 | $parent_link_text = empty($parent_title) ? explode(':',$parent->nodeId())[1] : $parent_title.' ('.explode(':',$parent->nodeId())[1].')'; |
||
336 | |||
129 | daniel-mar | 337 | $out['text'] = '<p><a '.oidplus_link($parent->nodeId()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
98 | daniel-mar | 338 | } |
103 | daniel-mar | 339 | } else { |
340 | $parent_link_text = 'Go back to front page'; |
||
127 | daniel-mar | 341 | $out['text'] = '<p><a '.oidplus_link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
98 | daniel-mar | 342 | } |
343 | |||
183 | daniel-mar | 344 | // --- |
345 | |||
346 | if (!is_null($row) && isset($row['description'])) { |
||
347 | if (empty($row['description'])) { |
||
348 | if (empty($row['title'])) { |
||
349 | $desc = '<p><i>No description for this object available</i></p>'; |
||
350 | } else { |
||
351 | $desc = $row['title']; |
||
352 | } |
||
353 | } else { |
||
354 | $desc = OIDplusGui::objDescription($row['description']); |
||
355 | } |
||
356 | |||
357 | if ($obj->userHasWriteRights()) { |
||
358 | $rand = ++self::$crudCounter; |
||
359 | $desc = '<noscript><p><b>You need to enable JavaScript to edit title or description of this object.</b></p>'.$desc.'</noscript>'; |
||
360 | $desc .= '<div class="container box" style="display:none" id="descbox_'.$rand.'">'; |
||
361 | $desc .= 'Title: <input type="text" name="title" id="titleedit" value="'.htmlentities($row['title']).'"><br><br>Description:<br>'; |
||
362 | $desc .= self::showMCE('description', $row['description']); |
||
363 | $desc .= '<button type="button" name="update_desc" id="update_desc" class="btn btn-success btn-xs update" onclick="updateDesc()">Update description</button>'; |
||
364 | $desc .= '</div>'; |
||
365 | $desc .= '<script>document.getElementById("descbox_'.$rand.'").style.display = "block";</script>'; |
||
366 | } |
||
367 | } else { |
||
368 | $desc = ''; |
||
369 | } |
||
370 | |||
371 | // --- |
||
372 | |||
2 | daniel-mar | 373 | if (strpos($out['text'], '%%DESC%%') !== false) |
374 | $out['text'] = str_replace('%%DESC%%', $desc, $out['text']); |
||
375 | if (strpos($out['text'], '%%CRUD%%') !== false) |
||
376 | $out['text'] = str_replace('%%CRUD%%', self::showCrud($id), $out['text']); |
||
377 | if (strpos($out['text'], '%%RA_INFO%%') !== false) |
||
104 | daniel-mar | 378 | $out['text'] = str_replace('%%RA_INFO%%', OIDplusPagePublicRaInfo::showRaInfo($row['ra_email']), $out['text']); |
101 | daniel-mar | 379 | |
193 | daniel-mar | 380 | $alt_ids = $obj->getAltIds(); |
381 | if (count($alt_ids) > 0) { |
||
382 | $out['text'] .= "<h2>Alternative Identifiers</h2>"; |
||
228 | daniel-mar | 383 | foreach ($alt_ids as $alt_id) { |
384 | $ns = $alt_id->getNamespace(); |
||
385 | $aid = $alt_id->getId(); |
||
386 | $aiddesc = $alt_id->getDescription(); |
||
193 | daniel-mar | 387 | $out['text'] .= "$aiddesc <code>$ns:$aid</code><br>"; |
388 | } |
||
389 | } |
||
390 | |||
101 | daniel-mar | 391 | foreach (OIDplus::getPagePlugins('public') as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']); |
392 | foreach (OIDplus::getPagePlugins('ra') as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']); |
||
393 | foreach (OIDplus::getPagePlugins('admin') as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']); |
||
103 | daniel-mar | 394 | } else { |
120 | daniel-mar | 395 | // Other pages (search, whois, etc.) |
396 | /* |
||
397 | if ($id != 'oidplus:system') { |
||
103 | daniel-mar | 398 | $parent_link_text = 'Go back to front page'; |
127 | daniel-mar | 399 | $out['text'] = '<p><a '.oidplus_link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
103 | daniel-mar | 400 | } |
120 | daniel-mar | 401 | */ |
2 | daniel-mar | 402 | } |
403 | |||
404 | return $out; |
||
405 | } |
||
406 | } |