Subversion Repositories oidplus

Rev

Rev 238 | Rev 251 | 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
                        }
250 daniel-mar 104
 
105
                        $date_created = explode(' ', $row->created)[0] == '0000-00-00' ? '' : explode(' ', $row->created)[0];
106
                        $date_updated = explode(' ', $row->updated)[0] == '0000-00-00' ? '' : explode(' ', $row->updated)[0];
2 daniel-mar 107
 
108
                        $output .= '<tr>';
104 daniel-mar 109
                        $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 110
                        if ($objParent->userHasWriteRights()) {
206 daniel-mar 111
                                if ($parentNS == 'oid') {
112
                                        if ($one_weid_available) {
113
                                                if ($obj->isWeid(false)) {
114
                                                        $output .= '    <td>'.$obj->weidArc().'</td>';
115
                                                } else {
116
                                                        $output .= '    <td>n/a</td>';
117
                                                }
196 daniel-mar 118
                                        }
5 daniel-mar 119
                                        $output .= '     <td><input type="text" id="asn1ids_'.$row->id.'" value="'.implode(', ', $asn1ids).'"></td>';
120
                                        $output .= '     <td><input type="text" id="iris_'.$row->id.'" value="'.implode(', ', $iris).'"></td>';
121
                                }
204 daniel-mar 122
                                $output .= '     <td><input type="text" id="ra_email_'.$row->id.'" value="'.htmlentities($row->ra_email).'"></td>';
123
                                $output .= '     <td><input type="text" id="comment_'.$row->id.'" value="'.htmlentities($row->comment).'"></td>';
2 daniel-mar 124
                                $output .= '     <td><input type="checkbox" id="hide_'.$row->id.'" '.($row->confidential ? 'checked' : '').'></td>';
104 daniel-mar 125
                                $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>';
126
                                $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>';
250 daniel-mar 127
                                $output .= '     <td>'.$date_created.'</td>';
128
                                $output .= '     <td>'.$date_updated.'</td>';
2 daniel-mar 129
                        } else {
130
                                if ($asn1ids == '') $asn1ids = '<i>(none)</i>';
131
                                if ($iris == '') $iris = '<i>(none)</i>';
206 daniel-mar 132
                                if ($parentNS == 'oid') {
133
                                        if ($one_weid_available) {
134
                                                if ($obj->isWeid(false)) {
135
                                                        $output .= '    <td>'.$obj->weidArc().'</td>';
136
                                                } else {
137
                                                        $output .= '    <td>n/a</td>';
138
                                                }
196 daniel-mar 139
                                        }
5 daniel-mar 140
                                        $asn1ids_ext = array();
141
                                        foreach ($asn1ids as $asn1id) {
104 daniel-mar 142
                                                $asn1ids_ext[] = '<a href="?goto='.urlencode($row->id).'" onclick="openAndSelectNode('.js_escape($row->id).', '.js_escape($parent).'); return false;">'.$asn1id.'</a>';
5 daniel-mar 143
                                        }
144
                                        $output .= '     <td>'.implode(', ', $asn1ids_ext).'</td>';
145
                                        $output .= '     <td>'.implode(', ', $iris).'</td>';
146
                                }
250 daniel-mar 147
                                $output .= '     <td><a '.OIDplus::gui()->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 148
                                $output .= '     <td>'.htmlentities($row->comment).'</td>';
250 daniel-mar 149
                                $output .= '     <td>'.$date_created.'</td>';
150
                                $output .= '     <td>'.$date_updated.'</td>';
2 daniel-mar 151
                        }
152
                        $output .= '</tr>';
153
                }
154
 
150 daniel-mar 155
                $result = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($parent));
236 daniel-mar 156
                $parent_ra_email = $result->num_rows() > 0 ? $result->fetch_object()->ra_email : '';
2 daniel-mar 157
 
158
                if ($objParent->userHasWriteRights()) {
159
                        $output .= '<tr>';
160
                        $prefix = is_null($objParent) ? '' : $objParent->crudInsertPrefix();
206 daniel-mar 161
                        if ($parentNS == 'oid') {
199 daniel-mar 162
                                if ($objParent->isWeid(true)) {
163
                                        $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
164
                                        $output .= '     <td><input type="text" name="weid" id="weid" value="" oninput="frdl_weid_change()"></td>';
165
                                } else {
166
                                        $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 167
                                        if ($one_weid_available) $output .= '     <td></td>'; // WEID-editor not available for root nodes. Do it manually, please
199 daniel-mar 168
                                }
2 daniel-mar 169
                        } else {
170
                                $output .= '     <td>'.$prefix.' <input type="text" id="id" value=""></td>';
171
                        }
206 daniel-mar 172
                        if ($parentNS == 'oid') $output .= '     <td><input type="text" id="asn1ids" value=""></td>';
173
                        if ($parentNS == 'oid') $output .= '     <td><input type="text" id="iris" value=""></td>';
2 daniel-mar 174
                        $output .= '     <td><input type="text" id="ra_email" value="'.htmlentities($parent_ra_email).'"></td>';
204 daniel-mar 175
                        $output .= '     <td><input type="text" id="comment" value=""></td>';
2 daniel-mar 176
                        $output .= '     <td><input type="checkbox" id="hide"></td>';
104 daniel-mar 177
                        $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 178
                        $output .= '     <td></td>';
179
                        $output .= '     <td></td>';
180
                        $output .= '     <td></td>';
181
                        $output .= '</tr>';
182
                } else {
183
                        if ($items_total-$items_hidden == 0) {
206 daniel-mar 184
                                $cols = ($parentNS == 'oid') ? 7 : 5;
185
                                if ($one_weid_available) $cols++;
2 daniel-mar 186
                                $output .= '<tr><td colspan="'.$cols.'">No items available</td></tr>';
187
                        }
188
                }
189
 
190
                $output .= '</table>';
191
                $output .= '</div></div>';
192
 
193
                if ($items_hidden == 1) {
250 daniel-mar 194
                        $output .= '<p>'.$items_hidden.' item is hidden. Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to see it.</p>';
2 daniel-mar 195
                } else if ($items_hidden > 1) {
250 daniel-mar 196
                        $output .= '<p>'.$items_hidden.' items are hidden. Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to see them.</p>';
2 daniel-mar 197
                }
198
 
199
                return $output;
200
        }
201
 
136 daniel-mar 202
        // 'quickbars' added 11 July 2019: Disabled because of two problems:
203
        //                                 1. When you load TinyMCE via AJAX using the left menu, the quickbar is immediately shown, even if TinyMCE does not have the focus
204
        //                                 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 205
        // 'colorpicker', 'textcolor' and 'contextmenu' added in 07 April 2020, because it is built in in the core.
206
        public static $exclude_tinymce_plugins = array('fullpage', 'bbcode', 'quickbars', 'colorpicker', 'textcolor', 'contextmenu');
2 daniel-mar 207
 
208
        protected static function showMCE($name, $content) {
209
                $mce_plugins = array();
4 daniel-mar 210
                foreach (glob(__DIR__ . '/../../3p/tinymce/plugins/*') as $m) { // */
2 daniel-mar 211
                        $mce_plugins[] = basename($m);
212
                }
213
 
214
                foreach (self::$exclude_tinymce_plugins as $exclude) {
215
                        $index = array_search($exclude, $mce_plugins);
216
                        if ($index !== false) unset($mce_plugins[$index]);
217
                }
218
 
4 daniel-mar 219
                $out = '<script>
220
                                tinymce.remove("#'.$name.'");
238 daniel-mar 221
                                tinymce.EditorManager.baseURL = "3p/tinymce";
2 daniel-mar 222
                                tinymce.init({
238 daniel-mar 223
                                        document_base_url: "'.OIDplus::getSystemUrl().'",
4 daniel-mar 224
                                        selector: "#'.$name.'",
225
                                        height: 200,
226
                                        statusbar: false,
227
//                                      menubar:false,
228
//                                      toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table | fontsizeselect",
229
                                        toolbar: "undo redo | styleselect | bold italic underline forecolor | bullist numlist | outdent indent | table | fontsizeselect",
123 daniel-mar 230
                                        plugins: "'.implode(' ', $mce_plugins).'",
231
                                        mobile: {
232
                                                theme: "mobile",
233
                                                toolbar: "undo redo | styleselect | bold italic underline forecolor | bullist numlist | outdent indent | table | fontsizeselect",
234
                                                plugins: "'.implode(' ', $mce_plugins).'"
235
                                        }
236
 
2 daniel-mar 237
                                });
4 daniel-mar 238
                        </script>';
2 daniel-mar 239
 
89 daniel-mar 240
                $content = htmlentities($content); // For some reason, if we want to display the text "<xyz>" in TinyMCE, we need to double-encode things! &lt; will not be accepted, we need &amp;lt; ... why?
241
 
4 daniel-mar 242
                $out .= '<textarea name="'.htmlentities($name).'" id="'.htmlentities($name).'">'.trim($content).'</textarea><br>';
2 daniel-mar 243
 
244
                return $out;
245
        }
246
 
247
        public static function generateContentPage($id) {
248
                $out = array();
249
 
250
                $handled = false;
251
                $out['title'] = '';
32 daniel-mar 252
                $out['icon'] = '';
2 daniel-mar 253
                $out['text'] = '';
254
 
255
                // === Plugins ===
256
 
61 daniel-mar 257
                foreach (OIDplus::getPagePlugins('*') as $plugin) {
258
                        $plugin->gui($id, $out, $handled);
259
                }
2 daniel-mar 260
 
261
                // === Everything else (objects) ===
262
 
263
                if (!$handled) {
93 daniel-mar 264
                        try {
265
                                $obj = OIDplusObject::parse($id);
266
                        } catch (Exception $e) {
267
                                $out['title'] = 'Error';
268
                                $out['icon'] = 'img/error_big.png';
269
                                $out['text'] = htmlentities($e->getMessage());
270
                                return $out;
271
                        }
2 daniel-mar 272
 
273
                        if ((!is_null($obj)) && (!$obj->userHasReadRights())) {
274
                                $out['title'] = 'Access denied';
34 daniel-mar 275
                                $out['icon'] = 'img/error_big.png';
250 daniel-mar 276
                                $out['text'] = '<p>Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to receive information about this object.</p>';
2 daniel-mar 277
                                return $out;
278
                        }
279
 
183 daniel-mar 280
                        // ---
2 daniel-mar 281
 
98 daniel-mar 282
                        $parent = null;
183 daniel-mar 283
                        $res = null;
284
                        $row = null;
2 daniel-mar 285
                        $matches_any_registered_type = false;
227 daniel-mar 286
                        foreach (OIDplus::getEnabledObjectTypes() as $ot) {
2 daniel-mar 287
                                if ($obj = $ot::parse($id)) {
288
                                        $matches_any_registered_type = true;
183 daniel-mar 289
                                        if ($obj->isRoot()) {
34 daniel-mar 290
                                                $obj->getContentPage($out['title'], $out['text'], $out['icon']);
183 daniel-mar 291
                                                $parent = null; // $obj->getParent();
98 daniel-mar 292
                                                break;
183 daniel-mar 293
                                        } else {
294
                                                $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($obj->nodeId()));
236 daniel-mar 295
                                                $row = $res->fetch_array();
296
                                                if ($res->num_rows() == 0) {
183 daniel-mar 297
                                                        http_response_code(404);
298
                                                        $out['title'] = 'Object not found';
299
                                                        $out['icon'] = 'img/error_big.png';
300
                                                        $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.';
301
                                                        return $out;
302
                                                } else {
303
                                                        $obj->getContentPage($out['title'], $out['text'], $out['icon']);
227 daniel-mar 304
                                                        if (empty($out['title'])) $out['title'] = explode(':',$id,2)[1];
183 daniel-mar 305
                                                        $parent = $obj->getParent();
306
                                                        break;
307
                                                }
2 daniel-mar 308
                                        }
309
                                }
310
                        }
311
                        if (!$matches_any_registered_type) {
312
                                http_response_code(404);
313
                                $out['title'] = 'Object not found';
34 daniel-mar 314
                                $out['icon'] = 'img/error_big.png';
2 daniel-mar 315
                                $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.';
316
                                return $out;
317
                        }
318
 
183 daniel-mar 319
                        // ---
320
 
103 daniel-mar 321
                        if ($parent) {
322
                                if ($parent->isRoot()) {
98 daniel-mar 323
 
324
                                        $parent_link_text = $parent->objectTypeTitle();
250 daniel-mar 325
                                        $out['text'] = '<p><a '.OIDplus::gui()->link($parent->root()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text'];
98 daniel-mar 326
 
327
                                } else {
150 daniel-mar 328
                                        $res_ = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."objects where id = ?", array($parent->nodeId()));
236 daniel-mar 329
                                        $row_ = $res_->fetch_array();
98 daniel-mar 330
 
331
                                        $parent_title = $row_['title'];
332
                                        if (empty($parent_title) && ($parent->ns() == 'oid')) {
150 daniel-mar 333
                                                $res_ = OIDplus::db()->query("select name from ".OIDPLUS_TABLENAME_PREFIX."asn1id where oid = ?", array($parent->nodeId()));
236 daniel-mar 334
                                                $row_ = $res_->fetch_array();
98 daniel-mar 335
                                                $parent_title = $row_['name']; // TODO: multiple ASN1 ids?
336
                                        }
337
 
338
                                        $parent_link_text = empty($parent_title) ? explode(':',$parent->nodeId())[1] : $parent_title.' ('.explode(':',$parent->nodeId())[1].')';
339
 
250 daniel-mar 340
                                        $out['text'] = '<p><a '.OIDplus::gui()->link($parent->nodeId()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text'];
98 daniel-mar 341
                                }
103 daniel-mar 342
                        } else {
343
                                $parent_link_text = 'Go back to front page';
250 daniel-mar 344
                                $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text'];
98 daniel-mar 345
                        }
346
 
183 daniel-mar 347
                        // ---
348
 
349
                        if (!is_null($row) && isset($row['description'])) {
350
                                if (empty($row['description'])) {
351
                                        if (empty($row['title'])) {
352
                                                $desc = '<p><i>No description for this object available</i></p>';
353
                                        } else {
354
                                                $desc = $row['title'];
355
                                        }
356
                                } else {
357
                                        $desc = OIDplusGui::objDescription($row['description']);
358
                                }
359
 
360
                                if ($obj->userHasWriteRights()) {
361
                                        $rand = ++self::$crudCounter;
362
                                        $desc = '<noscript><p><b>You need to enable JavaScript to edit title or description of this object.</b></p>'.$desc.'</noscript>';
363
                                        $desc .= '<div class="container box" style="display:none" id="descbox_'.$rand.'">';
364
                                        $desc .= 'Title: <input type="text" name="title" id="titleedit" value="'.htmlentities($row['title']).'"><br><br>Description:<br>';
365
                                        $desc .= self::showMCE('description', $row['description']);
366
                                        $desc .= '<button type="button" name="update_desc" id="update_desc" class="btn btn-success btn-xs update" onclick="updateDesc()">Update description</button>';
367
                                        $desc .= '</div>';
368
                                        $desc .= '<script>document.getElementById("descbox_'.$rand.'").style.display = "block";</script>';
369
                                }
370
                        } else {
371
                                $desc = '';
372
                        }
373
 
374
                        // ---
375
 
2 daniel-mar 376
                        if (strpos($out['text'], '%%DESC%%') !== false)
377
                                $out['text'] = str_replace('%%DESC%%',    $desc,                              $out['text']);
378
                        if (strpos($out['text'], '%%CRUD%%') !== false)
379
                                $out['text'] = str_replace('%%CRUD%%',    self::showCrud($id),                $out['text']);
380
                        if (strpos($out['text'], '%%RA_INFO%%') !== false)
104 daniel-mar 381
                                $out['text'] = str_replace('%%RA_INFO%%', OIDplusPagePublicRaInfo::showRaInfo($row['ra_email']), $out['text']);
101 daniel-mar 382
 
193 daniel-mar 383
                        $alt_ids = $obj->getAltIds();
384
                        if (count($alt_ids) > 0) {
385
                                $out['text'] .= "<h2>Alternative Identifiers</h2>";
228 daniel-mar 386
                                foreach ($alt_ids as $alt_id) {
387
                                        $ns = $alt_id->getNamespace();
388
                                        $aid = $alt_id->getId();
389
                                        $aiddesc = $alt_id->getDescription();
193 daniel-mar 390
                                        $out['text'] .= "$aiddesc <code>$ns:$aid</code><br>";
391
                                }
392
                        }
393
 
101 daniel-mar 394
                        foreach (OIDplus::getPagePlugins('public') as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']);
395
                        foreach (OIDplus::getPagePlugins('ra')     as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']);
396
                        foreach (OIDplus::getPagePlugins('admin')  as $plugin) $plugin->modifyContent($id, $out['title'], $out['icon'], $out['text']);
103 daniel-mar 397
                } else {
120 daniel-mar 398
                        // Other pages (search, whois, etc.)
399
                        /*
400
                        if ($id != 'oidplus:system') {
103 daniel-mar 401
                                $parent_link_text = 'Go back to front page';
250 daniel-mar 402
                                $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text'];
103 daniel-mar 403
                        }
120 daniel-mar 404
                        */
2 daniel-mar 405
                }
406
 
407
                return $out;
408
        }
250 daniel-mar 409
 
410
        public static function link($goto) {
411
                if (strpos($goto, '#') !== false) {
412
                        list($goto, $anchor) = explode('#', $goto, 2);
413
                        return 'href="?goto='.urlencode($goto).'#'.htmlentities($anchor).'" onclick="openOidInPanel('.js_escape($goto).', true, '.js_escape($anchor).'); return false;"';
414
                } else {
415
                        return 'href="?goto='.urlencode($goto).'" onclick="openOidInPanel('.js_escape($goto).', true); return false;"';
416
                }
417
        }
2 daniel-mar 418
}