Rev 1130 | Rev 1189 | 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 |
||
1086 | daniel-mar | 5 | * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
754 | daniel-mar | 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 | |
1086 | daniel-mar | 25 | // phpcs:disable PSR1.Files.SideEffects |
26 | \defined('INSIDE_OIDPLUS') or die; |
||
27 | // phpcs:enable PSR1.Files.SideEffects |
||
28 | |||
1131 | daniel-mar | 29 | class OIDplusPageAdminNostalgia extends OIDplusPagePluginAdmin |
30 | implements INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_8 /* getNotifications */ |
||
31 | { |
||
754 | daniel-mar | 32 | |
1116 | daniel-mar | 33 | /** |
34 | * @param string $id |
||
35 | * @param array $out |
||
36 | * @param bool $handled |
||
37 | * @return void |
||
38 | * @throws OIDplusException |
||
39 | */ |
||
40 | public function gui(string $id, array &$out, bool &$handled) { |
||
754 | daniel-mar | 41 | if ($id === 'oidplus:nostalgia') { |
42 | $handled = true; |
||
43 | $out['title'] = _L('Nostalgia'); |
||
801 | daniel-mar | 44 | $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
754 | daniel-mar | 45 | |
46 | if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
||
800 | daniel-mar | 47 | $out['icon'] = 'img/error.png'; |
754 | daniel-mar | 48 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')).'</p>'; |
49 | return; |
||
50 | } |
||
51 | |||
52 | $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 | 53 | |
54 | if (class_exists('ZipArchive')) { |
||
55 | $out['text'] .= '<ul>'; |
||
801 | daniel-mar | 56 | $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 | 57 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/252/oidplus_dos.zip">'._L('Download OIDplus for DOS').'</a>, '._L('without data').'</li>'; |
1064 | daniel-mar | 58 | $out['text'] .= '<li><a href="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'export_win.php">'._L('Download OIDplus for Windows 3.11, 95, or later').'</a>, '._L('including your database* (only OIDs)').'</li>'; |
755 | daniel-mar | 59 | $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>'; |
60 | $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>'; |
||
61 | $out['text'] .= '</ul>'; |
||
768 | daniel-mar | 62 | $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 | 63 | } else { |
64 | $out['text'] .= '<ul>'; |
||
65 | $out['text'] .= '<li><a href="https://www.viathinksoft.de/download/252/oidplus_dos.zip">'._L('Download OIDplus for DOS').'</a>, '._L('without data').'</li>'; |
||
66 | $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>'; |
||
67 | $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>'; |
||
68 | $out['text'] .= '</ul>'; |
||
69 | $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>'; |
||
70 | } |
||
754 | daniel-mar | 71 | } |
72 | } |
||
73 | |||
1116 | daniel-mar | 74 | /** |
75 | * @param array $json |
||
76 | * @param string|null $ra_email |
||
77 | * @param bool $nonjs |
||
78 | * @param string $req_goto |
||
79 | * @return bool |
||
80 | * @throws OIDplusException |
||
81 | */ |
||
82 | public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool { |
||
754 | daniel-mar | 83 | if (!OIDplus::authUtils()->isAdminLoggedIn()) return false; |
84 | |||
800 | daniel-mar | 85 | if (file_exists(__DIR__.'/img/main_icon16.png')) { |
801 | daniel-mar | 86 | $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png'; |
754 | daniel-mar | 87 | } else { |
88 | $tree_icon = null; // default icon (folder) |
||
89 | } |
||
90 | |||
91 | $json[] = array( |
||
92 | 'id' => 'oidplus:nostalgia', |
||
93 | 'icon' => $tree_icon, |
||
94 | 'text' => _L('Nostalgia') |
||
95 | ); |
||
96 | |||
97 | return true; |
||
98 | } |
||
99 | |||
1116 | daniel-mar | 100 | /** |
101 | * @param string $request |
||
102 | * @return array|false |
||
103 | */ |
||
104 | public function tree_search(string $request) { |
||
754 | daniel-mar | 105 | return false; |
106 | } |
||
1000 | daniel-mar | 107 | |
1116 | daniel-mar | 108 | /** |
1131 | daniel-mar | 109 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_8 |
1130 | daniel-mar | 110 | * @param string|null $user |
1116 | daniel-mar | 111 | * @return array |
112 | * @throws OIDplusException |
||
113 | */ |
||
1130 | daniel-mar | 114 | public function getNotifications(string $user=null): array { |
1000 | daniel-mar | 115 | $notifications = array(); |
116 | if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) { |
||
117 | if (!class_exists('ZipArchive')) { |
||
118 | $title = _L('Nostalgia'); |
||
1015 | daniel-mar | 119 | $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 | 120 | } |
121 | } |
||
122 | return $notifications; |
||
123 | } |
||
124 | |||
125 | } |