1<?php 2/** 3 * DokuWiki Plugin photogallery (Admin Component) 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Marco Nolletti 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12require_once('inc/pgdefines.php'); 13 14class admin_plugin_photogallery extends DokuWiki_Admin_Plugin { 15 16 /** 17 * @return int sort number in admin menu 18 */ 19 public function getMenuSort() { 20 return 1000; 21 } 22 23 /** 24 * @return bool true if only access for superuser, false is for superusers and moderators 25 */ 26 public function forAdminOnly() { 27 return false; 28 } 29 30 /** 31 * Should carry out any processing required by the plugin. 32 */ 33 public function handle() { 34 } 35 36 /** 37 * Render HTML output, e.g. helpful text and a form 38 */ 39 public function html() { 40 ptln('<h1>'.$this->getLang('menu').'</h1>'); 41 ptln('<div class="table-responsive">'); 42 ptln('<table class="inline table table-striped table-condensed">'); 43 $this->_info_row('Plugin info','Value',' ',true); 44 $info = $this->getInfo(); 45 $this->_info_row('Plugin version',$info['date']); 46 $this->_info_row('Author',$info['author']); 47 $this->_info_row('Server parameters','Value','Status',true); 48 $this->_info_row('Plugin folder',__DIR__); 49 $ok = version_compare(PHP_VERSION,'5.4.45',">="); 50 $this->_info_row('Current PHP version',phpversion(),$ok); 51 $this->_info_row('Running webserver',htmlentities($_SERVER['SERVER_SOFTWARE'])); 52 $this->_info_row('PHP memory limit',ini_get('memory_limit')); 53 $ok = extension_loaded('exif'); 54 $this->_info_row('EXIF extension',($ok ? '' : 'not').' loaded',$ok); 55 $ok = extension_loaded('curl'); 56 $this->_info_row('CURL extension',($ok ? '' : 'not').' loaded',$ok); 57 $ok = extension_loaded('exif'); 58 $this->_info_row('IMAGICK extension',($ok ? '' : 'not').' loaded',$ok); 59 $ok = extension_loaded('zip'); 60 $this->_info_row('ZIP extension',($ok ? '' : 'not').' loaded',$ok); 61 $ok = extension_loaded('gd'); 62 $this->_info_row('GD extension',($ok ? '' : 'not').' loaded',$ok); 63 if($ok){ 64 $info = gd_info(); 65 foreach($info as $key => $value) { 66 $this->_info_row('|-- '.$key,$value); 67 } 68 } 69 $this->_info_row('phpThumb requirements','Value','Status',true); 70 $arr = array ('exec','system','shell_exec','passthru'); 71 $info = explode(',',@ini_get('disable_functions')); 72 for ($i = 0; $i<count($info); $i++){ 73 if (array_search($info[$i],$arr) === false){ 74 array_splice($info,$i,1); 75 $i--; 76 } 77 } 78 $ok = (count($info) < count($arr)); 79 $info = implode(', ',$info); 80 $this->_info_row('Important disabled functions',$info,$ok); 81 $info = fileperms(PHOTOGALLERY_PGFETCH_FILE) & 0xFFF; 82 $ok = (($info & PHOTOGALLERY_PGFETCH_EXE_PERM) == PHOTOGALLERY_PGFETCH_EXE_PERM); 83 $this->_info_row('pgImg.php execute permissions',sprintf('%o',$info),$ok); 84 ptln('</table>'); 85 ptln('</div>'); 86 } 87 88 function _info_row($item, $value, $state = null, $header = false){ 89 if ($header) 90 ptln('<thead>'); 91 ptln('<tr>'); 92 $this->_info_cell($item,$header); 93 $this->_info_cell($value,$header); 94 if(is_bool($state)) 95 $this->_info_cell($state ? "ok" : "error",$header); 96 else 97 $this->_info_cell($state,$header); 98 ptln('</tr>'); 99 if ($header) 100 ptln('</thead>'); 101 } 102 103 function _info_cell($text, $header = false){ 104 if ($header) 105 ptln('<th>'); 106 else 107 ptln('<td>'); 108 if ($text != '') 109 ptln($text); 110 else 111 ptln(' '); 112 if ($header) 113 ptln('</th>'); 114 else 115 ptln('</td>'); 116 } 117} 118