Subversion Repositories oidplus

Rev

Rev 241 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  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.  
  20. if (!defined('IN_OIDPLUS')) die();
  21.  
  22. class OIDplusPageAdminSoftwareUpdate extends OIDplusPagePlugin {
  23.         public static function getPluginInformation() {
  24.                 $out = array();
  25.                 $out['name'] = 'Software update';
  26.                 $out['author'] = 'ViaThinkSoft';
  27.                 $out['version'] = null;
  28.                 $out['descriptionHTML'] = null;
  29.                 return $out;
  30.         }
  31.  
  32.         public function type() {
  33.                 return 'admin';
  34.         }
  35.  
  36.         public function priority() {
  37.                 return 900;
  38.         }
  39.  
  40.         public function action(&$handled) {
  41.         }
  42.  
  43.         public function init($html=true) {
  44.         }
  45.  
  46.         public function cfgSetValue($name, $value) {
  47.         }
  48.  
  49.         public function gui($id, &$out, &$handled) {
  50.                 $parts = explode('.',$id,2);
  51.                 if (!isset($parts[1])) $parts[1] = '';
  52.                 if ($parts[0] != 'oidplus:software_update') return;
  53.                 $handled = true;
  54.                 $out['title'] = 'Software update';
  55.                 $out['icon']  = OIDplus::webpath(__DIR__).'icon_big.png';
  56.  
  57.                 if (!OIDplus::authUtils()::isAdminLoggedIn()) {
  58.                         $out['icon'] = 'img/error_big.png';
  59.                         $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as administrator.</p>';
  60.                         return $out;
  61.                 }
  62.  
  63.                 $out['text']  = '<p>You can perform a system update by clicking the bottom below.</p>';
  64.                 $out['text'] .= '<p><input type="button" onclick="document.location=\'update/\'" value="Start update assistant"></p>';
  65.         }
  66.  
  67.         public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
  68.                 if (file_exists(__DIR__.'/treeicon.png')) {
  69.                         $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png';
  70.                 } else {
  71.                         $tree_icon = null; // default icon (folder)
  72.                 }
  73.  
  74.                 $json[] = array(
  75.                         'id' => 'oidplus:software_update',
  76.                         'icon' => $tree_icon,
  77.                         'text' => 'Software update'
  78.                 );
  79.  
  80.                 return true;
  81.         }
  82.  
  83.         public function tree_search($request) {
  84.                 return false;
  85.         }
  86. }
  87.