Subversion Repositories oidplus

Rev

Rev 1086 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * OIDplus 2.0
  5.  * Copyright 2019 - 2023 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. namespace ViaThinkSoft\OIDplus;
  21.  
  22. // phpcs:disable PSR1.Files.SideEffects
  23. \defined('INSIDE_OIDPLUS') or die;
  24. // phpcs:enable PSR1.Files.SideEffects
  25.  
  26. class OIDplusPagePublicContactEMail extends OIDplusPagePluginPublic {
  27.  
  28.         /**
  29.          * @param bool $html
  30.          * @return void
  31.          */
  32.         public function init(bool $html=true) {
  33.                 // Nothing
  34.         }
  35.  
  36.         /**
  37.          * @param string $id
  38.          * @param array $out
  39.          * @param bool $handled
  40.          * @return void
  41.          * @throws OIDplusException
  42.          */
  43.         public function gui(string $id, array &$out, bool &$handled) {
  44.                 if ($id === 'oidplus:contact') {
  45.                         $handled = true;
  46.                         $out['title'] = _L('Contact administrator');
  47.                         $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
  48.  
  49.                         if (empty(OIDplus::config()->getValue('admin_email'))) {
  50.                                 $out['text'] = '<p>'._L('The administrator of this OIDplus system has not entered a contact email address.').'</p>';
  51.                         } else {
  52.                                 $admin_email = OIDplus::config()->getValue('admin_email');
  53.                                 $out['text'] = '<p>'._L('You can contact the administrator of this OIDplus system at this email address').':</p><p><a href="mailto:'.htmlentities($admin_email).'">'.htmlentities($admin_email).'</a></p>';
  54.                         }
  55.                 }
  56.         }
  57.  
  58.         /**
  59.          * @param array $out
  60.          * @return void
  61.          */
  62.         public function publicSitemap(array &$out) {
  63.                 $out[] = 'oidplus:contact';
  64.         }
  65.  
  66.         /**
  67.          * @param array $json
  68.          * @param string|null $ra_email
  69.          * @param bool $nonjs
  70.          * @param string $req_goto
  71.          * @return bool
  72.          * @throws OIDplusException
  73.          */
  74.         public function tree(array &$json, string $ra_email=null, bool $nonjs=false, string $req_goto=''): bool {
  75.                 if (file_exists(__DIR__.'/img/main_icon16.png')) {
  76.                         $tree_icon = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon16.png';
  77.                 } else {
  78.                         $tree_icon = null; // default icon (folder)
  79.                 }
  80.  
  81.                 $json[] = array(
  82.                         'id' => 'oidplus:contact',
  83.                         'icon' => $tree_icon,
  84.                         'text' => _L('Contact administrator')
  85.                 );
  86.  
  87.                 return true;
  88.         }
  89.  
  90.         /**
  91.          * @param string $request
  92.          * @return array|false
  93.          */
  94.         public function tree_search(string $request) {
  95.                 return false;
  96.         }
  97. }
  98.