Rev 1015 | Rev 1064 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
754 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 - 2021 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 | |||
20 | // ATTENTION: If you change something, please make sure that the changes |
||
21 | // are synchronous with OIDplusPageRaAutomatedAJAXCalls |
||
22 | |||
1050 | daniel-mar | 23 | namespace ViaThinkSoft\OIDplus; |
754 | daniel-mar | 24 | |
25 | class OIDplusPageAdminNostalgia extends OIDplusPagePluginAdmin { |
||
26 | |||
27 | public function gui($id, &$out, &$handled) { |
||
28 | if ($id === 'oidplus:nostalgia') { |
||
29 | $handled = true; |
||
30 | $out['title'] = _L('Nostalgia'); |
||
801 | daniel-mar | 31 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
754 | daniel-mar | 32 | |
33 | if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
||
800 | daniel-mar | 34 | $out['icon'] = 'img/error.png'; |
754 | daniel-mar | 35 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')).'</p>'; |
36 | return; |
||
37 | } |
||
38 | |||
39 | $out['text'] = '<p>'._L('Did you ever wonder what OIDplus would look like if it had been created in the era of MS-DOS, Windows 3.11, or Windows 95? Just download the ZIP files below and have a look!').'</p>'; |
||
755 | daniel-mar | 40 | |
41 | if (class_exists('ZipArchive')) { |
||
42 | $out['text'] .= '<ul>'; |
||
801 | daniel-mar | 43 | $out['text'] .= '<li><a href="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'export_dos.php">'._L('Download OIDplus for DOS').'</a>, '._L('including your database* (only OIDs)').'</li>'; |
755 | daniel-mar | 44 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/252/oidplus_dos.zip">'._L('Download OIDplus for DOS').'</a>, '._L('without data').'</li>'; |
801 | daniel-mar | 45 | $out['text'] .= '<li><a href="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'export_win.php">'._L('Download OIDplus for Windows 3.11').'</a>, '._L('including your database* (only OIDs)').'</li>'; |
755 | daniel-mar | 46 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/254/oidplus_win311.zip">'._L('Download OIDplus for Windows 3.11').'</a>, '._L('without data').'</li>'; |
801 | daniel-mar | 47 | $out['text'] .= '<li><a href="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'export_win.php">'._L('Download OIDplus for Windows 95 or later').'</a>, '._L('including your database* (only OIDs)').'</li>'; |
755 | daniel-mar | 48 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/253/oidplus_win95.zip">'._L('Download OIDplus for Windows 95 or later').'</a>, '._L('without data').'</li>'; |
49 | $out['text'] .= '</ul>'; |
||
768 | daniel-mar | 50 | $out['text'] .= '<p>'._L('* Please note that the download might be delayed since your OID database is exported and added to the ZIP file.').'</p>'; |
755 | daniel-mar | 51 | } else { |
52 | $out['text'] .= '<ul>'; |
||
53 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/252/oidplus_dos.zip">'._L('Download OIDplus for DOS').'</a>, '._L('without data').'</li>'; |
||
54 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/254/oidplus_win311.zip">'._L('Download OIDplus for Windows 3.11').'</a>, '._L('without data').'</li>'; |
||
55 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/253/oidplus_win95.zip">'._L('Download OIDplus for Windows 95 or later').'</a>, '._L('without data').'</li>'; |
||
56 | $out['text'] .= '</ul>'; |
||
57 | $out['text'] .= '<p><font color="red">'._L('The PHP extension "ZipArchive" needs to be installed to create a ZIP archive with an included database. Otherwise, you can just download the plain program without data.').'</font></p>'; |
||
58 | } |
||
754 | daniel-mar | 59 | } |
60 | } |
||
61 | |||
62 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
||
63 | if (!OIDplus::authUtils()->isAdminLoggedIn()) return false; |
||
64 | |||
800 | daniel-mar | 65 | if (file_exists(__DIR__.'/img/main_icon16.png')) { |
801 | daniel-mar | 66 | $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png'; |
754 | daniel-mar | 67 | } else { |
68 | $tree_icon = null; // default icon (folder) |
||
69 | } |
||
70 | |||
71 | $json[] = array( |
||
72 | 'id' => 'oidplus:nostalgia', |
||
73 | 'icon' => $tree_icon, |
||
74 | 'text' => _L('Nostalgia') |
||
75 | ); |
||
76 | |||
77 | return true; |
||
78 | } |
||
79 | |||
80 | public function tree_search($request) { |
||
81 | return false; |
||
82 | } |
||
1000 | daniel-mar | 83 | |
84 | public function implementsFeature($id) { |
||
85 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.8') return true; // getNotifications() |
||
86 | return false; |
||
87 | } |
||
88 | |||
89 | public function getNotifications($user=null): array { |
||
90 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.8 |
||
91 | $notifications = array(); |
||
92 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
||
93 | if (!class_exists('ZipArchive')) { |
||
94 | $title = _L('Nostalgia'); |
||
1015 | daniel-mar | 95 | $notifications[] = array('ERR', _L('OIDplus plugin "%1" is enabled, but the required PHP extension "%2" is not installed.', '<a '.OIDplus::gui()->link('oidplus:nostalgia').'>'.htmlentities($title).'</a>', 'Zip')); |
1000 | daniel-mar | 96 | } |
97 | } |
||
98 | return $notifications; |
||
99 | } |
||
100 | |||
101 | } |