1<?php 2/** 3 * DokuWiki Plugin serverinfos (Admin Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author laurent bisson <bisson.lau@wanadoo.fr> 7 * 8 */ 9/* Historique 10* v1.6 / 1 Octobre 2019 11* - Compatibilité avec FreeBSD 12* 13* v1.5.1 / 14 Juin 2017 14* - icone pour processeur Xeon 15* 16* v1.5 / 2 Juillet 2016 17* - Correction d'un bug d'affichage de la fréquence cpu 18* - Nouveau logo pour cpu Intel Atom 19* - Affichage de l'état des services sous linux: 20* dns, dhcp, samba, ftp, ssh, radius, mysql 21* 22* v1.4 / 24 Avril 2016 23* - Codé en orienté objet 24* - Amélioration de la compatibilité avec windows 25* - Présentation des données sous forme de tableau 26* - Compatibilité avec Raspberry pi 27*/ 28 29// must be run within Dokuwiki 30if(!defined('DOKU_INC')) die(); 31 32class admin_plugin_serverinfos extends DokuWiki_Admin_Plugin 33{ 34 /** 35 * @return bool true if only access for superuser, false is for superusers and moderators 36 */ 37 public function forAdminOnly() { 38 return true; 39 } 40 41 /** 42 * Should carry out any processing required by the plugin. 43 */ 44 public function handle() { 45 } 46 47 /** 48 * Render HTML output, e.g. helpful text and a form 49 */ 50 public function html() 51 { 52 echo "<link rel='stylesheet' media='screen' type='text/css' id='css' href='style.css' />"; 53 echo "<div id='corps'>"; 54 echo "<div id='infos'>"; 55 56 // On enregistre notre autoload. 57 function chargerClasse($classname) 58 { 59 require 'lib/'.$classname.'.class.php'; 60 } 61 62 spl_autoload_register('chargerClasse'); 63 64 $infosServeur = new InfosServer(); 65 $elements = new Elements(); 66 67 // Calcul uptime 68 $uptime = $elements->getTime(); 69 70 // En-tete 71 $elements->displayEntete($infosServeur, $this->getLang('name'),$this->locale_xhtml('intro')); 72 73 // 74 // UPTIME 75 // 76 // Affiche données UPTIME si OS différent de windows 77 IF (PHP_OS != "WINNT") 78 { 79 // Affiche la catégorie 80 $elements->displayHead($this->getLang('vauptime')); 81 82 // Affiche les valeurs 83 echo "<div id='categorie_contenu' class='categorie'>"; 84 85 // Noms 86 echo "<div id='categorie_contenu' class='categorie'>"; 87 echo "<div id='categorie_contenu_php'><strong>".$this->getLang('server_local_time')."</strong></div>"; 88 echo "<div id='categorie_contenu_php'><strong>".$this->getLang('server_itil_uptime')."</strong></div>"; 89 echo "</div>"; 90 91 // Contenus 92 echo "<div id='categorie_contenu' class='valeur'>"; 93 echo "<div id='categorie_contenu_php'>".$elements->getLocalTime($uptime)."</div>"; 94 echo "<div id='categorie_contenu_php'>".$elements->getUpTime($uptime, $this->getLang('day'), $this->getLang('hour'), $this->getLang('minute'))."</div>"; // $ITIL 95 echo "</div>"; 96 97 echo "</div>"; 98 } 99 100 // SYSTEM 101 $elements->displaySystem($infosServeur, $this->getLang('system'), $this->getLang('server_os'), 102 $this->getLang('distrib'), $this->getLang('vmac')); 103 104 // HARDWARE 105 // Affiche la categorie 106 $elements->displayHead($this->getLang('hw')); 107 108 // Categorie 109 $elements->displayHwCategories($this->getLang('cpu'), $this->getLang('ram'), $this->getLang('dd')); 110 111 // Nom contenus 112 $elements->displayHwSCategories($this->getLang('cpu_mark'), $this->getLang('cpu_model'), $this->getLang('cpu_freq'), 113 $this->getLang('total'), $this->getLang('dd_free'), $this->getLang('dd_used')); 114 115 // Valeurs contenus 116 $elements->displayHwSCategoriesValues($infosServeur); 117 118 // SERVEUR WEB 119 // Affiche la categorie 120 $elements->displayHead($this->getLang('web')); 121 122 // Categorie 123 $elements->displayWebCategories($this->getLang('server_ip'), $this->getLang('server_name'), 124 $this->getLang('server_web'), $this->getLang('server_port')); 125 126 // Valeurs 127 $elements->displayWebValues(); 128 129 // SERVEUR PHP 130 // Affiche la categorie 131 $elements->displayHead($this->getLang('vaphp')); 132 133 // Categorie 134 $elements->displayPhpCategories($this->getLang('php_version'), $this->getLang('uploadmaxfilesize'), 135 $this->getLang('postmaxsize'), $this->getLang('memorylimit')); 136 137 // Valeurs 138 $elements->displayPhpValues(); 139 140 // Chemins php 141 $elements->displayPhpPath($this->getLang('document_root'), $this->getLang('path_toini')); 142 143 IF (PHP_OS == "Linux") 144 { 145 // AFFICHE LES SERVICES 146 // Affiche la categorie 147 $elements->displayHead($this->getLang('services')); 148 149 // Categories 150 $elements->displayServicesCategories(); 151 152 // Valeurs 153 $elements->displayServicesValues(); 154 } 155 156 echo "</div><!ferme infos>"; 157 158echo "</div><!ferme corps>"; 159 } 160} 161 162?> 163