AdministrationTree.class.php

gehe zur Dokumentation dieser Datei
00001 <?php
00002 #
00003 #  DaCMS Content Management System
00004 #  Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de
00005 #
00006 #  This program is free software; you can redistribute it and/or
00007 #  modify it under the terms of the GNU General Public License
00008 #  as published by the Free Software Foundation; either version 2
00009 #  of the License, or (at your option) any later version.
00010 #
00011 #  This program is distributed in the hope that it will be useful,
00012 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 #  GNU General Public License for more details.
00015 #
00016 #  You should have received a copy of the GNU General Public License
00017 #  along with this program; if not, write to the Free Software
00018 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 #
00020 
00027 class AdministrationTree extends AbstractTree
00028 {
00032      var $elements;
00033      var $confCache = array();
00034      
00035      function root()
00036      {
00037           if   ( !$this->userIsAdmin )
00038                Http::notAuthorized('Administration-Tree is only visible for admins.');
00039                
00040           $treeElement = new TreeElement();
00041           $treeElement->text        = lang('GLOBAL_ADMINISTRATION');
00042           $treeElement->description = lang('GLOBAL_ADMINISTRATION');
00043           $treeElement->type        = 'administration';
00044           $treeElement->icon        = 'administration';
00045           
00046           $this->addTreeElement( $treeElement );
00047           $this->autoOpen[] = 2;
00048      }
00049 
00050 
00051 
00052      function administration()
00053      {
00054           global $conf;
00055           $conf_config = $conf['interface']['config'];
00056 
00057           $treeElement = new TreeElement();
00058           $treeElement->text        = lang('GLOBAL_PROJECTS');
00059           $treeElement->description = lang('GLOBAL_PROJECTS');
00060           $treeElement->url         = Html::url('main','project','',array(REQ_PARAM_TARGETSUBACTION=>'listing'));
00061           $treeElement->icon        = 'project';
00062           $treeElement->type        = 'projects';
00063           $treeElement->target      = 'cms_main';
00064           
00065           $this->addTreeElement( $treeElement );
00066 
00067 
00068           $treeElement = new TreeElement();
00069           $treeElement->text        = lang('USER_AND_GROUPS');
00070           $treeElement->description = lang('USER_AND_GROUPS');
00071           $treeElement->icon        = 'group';
00072           $treeElement->type        = 'userandgroups';
00073           
00074           $this->addTreeElement( $treeElement );
00075 //        $this->userandgroups(0);;
00076 
00077           if   ( $conf_config['enable'] )
00078           {
00079                $treeElement = new TreeElement();
00080                $treeElement->text        = lang('PREFERENCES');
00081                $treeElement->description = lang('PREFERENCES');
00082                $treeElement->icon        = 'config_folder';
00083                $treeElement->type        = 'prefs';
00084                
00085                $this->addTreeElement( $treeElement );
00086           }
00087 
00088           // Wechseln zu: Projekte...
00089           /*
00090           foreach( Project::getAll() as $id=>$name )
00091           {
00092                $treeElement = new TreeElement();
00093                
00094                $treeElement->text         = lang('PROJECT').' '.$name;
00095                $treeElement->url          = Html::url(array('action'    =>'tree',
00096                                                             'subaction' =>'reload',
00097                                                             'projectid' =>$id       ));
00098                $treeElement->icon         = 'project';
00099                $treeElement->description  = '';
00100                $treeElement->target       = 'cms_tree';
00101 
00102                $this->addTreeElement( $treeElement );
00103           }
00104           */
00105      }
00106 
00107 
00108 
00109      function userandgroups( $id )
00110      {
00111           $treeElement = new TreeElement();
00112           $treeElement->text        = lang('GLOBAL_USER');
00113           $treeElement->description = lang('GLOBAL_USER');
00114           $treeElement->url         = Html::url('main','user','',array(REQ_PARAM_TARGETSUBACTION=>'listing'));
00115           $treeElement->icon        = 'user';
00116           $treeElement->target      = 'cms_main';
00117           $treeElement->type        = 'users';
00118           
00119           $this->addTreeElement( $treeElement );
00120 
00121           $treeElement = new TreeElement();
00122           $treeElement->text        = lang('GLOBAL_GROUPS');
00123           $treeElement->description = lang('GLOBAL_GROUPS');
00124           $treeElement->url         = Html::url('main','group','',array(REQ_PARAM_TARGETSUBACTION=>'listing'));
00125           $treeElement->icon        = 'group';
00126           $treeElement->target      = 'cms_main';
00127           $treeElement->type        = 'groups';
00128 
00129           $this->addTreeElement( $treeElement );
00130      }
00131 
00132 
00133      function projects( $id )
00134      {
00135           // Schleife ueber alle Projekte
00136           foreach( Project::getAll() as $id=>$name )
00137           {
00138                $treeElement = new TreeElement();
00139                
00140                $treeElement->internalId   = $id;
00141                $treeElement->text         = $name;
00142                $treeElement->url          = Html::url('main','project',$id,
00143                                                       array(REQ_PARAM_TARGETSUBACTION=>'edit') );
00144                $treeElement->icon         = 'project';
00145                $treeElement->description  = '';
00146                $treeElement->target       = 'cms_main';
00147 
00148                $this->addTreeElement( $treeElement );
00149           }
00150      }
00151 
00152 
00153 
00154      function prefs_system( $id )
00155      {
00156           $system = array( 'time'   => date('r'),
00157                            'os'     => php_uname('s'),
00158                            'host'   => php_uname('n'),
00159                            'release'=> php_uname('r'),
00160                            'machine'=> php_uname('m'),
00161                            'owner'  => get_current_user(),
00162                            'pid'    => getmypid()          );
00163           
00164           foreach( $system as $key=>$value )
00165           {
00166                $treeElement = new TreeElement();
00167                $treeElement->text = $key.'='.$value;
00168                $treeElement->icon   = 'config_property';
00169                $this->addTreeElement( $treeElement );
00170           }
00171 
00172           if   ( function_exists('getrusage') ) // Funktion existiert auf WIN32 nicht.
00173           {
00174                foreach( getrusage() as $name=>$value );
00175                {
00176                     $treeElement = new TreeElement();
00177                     $treeElement->text = $name.':'.$value;
00178                     $treeElement->icon   = 'config_property';
00179                     $this->addTreeElement( $treeElement );
00180                }
00181           }
00182      }
00183      
00184      
00185 
00186 
00187      function prefs_php( $id )
00188      {
00189           $php_prefs = array( 'version'             => phpversion(),
00190                               'SAPI'                => php_sapi_name(),
00191                               'session-name'        => session_name(),
00192                               'magic_quotes_gpc'    => get_magic_quotes_gpc(),
00193                               'magic_quotes_runtime'=> get_magic_quotes_runtime() );
00194 
00195           foreach( array('upload_max_filesize',
00196                          'file_uploads',
00197                          'memory_limit',
00198                          'max_execution_time',
00199                          'post_max_size',
00200                          'display_errors',
00201                          'register_globals'
00202                          ) as $iniName )
00203                $php_prefs[ $iniName ] = ini_get( $iniName );
00204                
00205           foreach( $php_prefs as $key=>$value )
00206           {
00207                $treeElement = new TreeElement();
00208                $treeElement->text = $key.'='.$value;
00209                $treeElement->icon   = 'config_property';
00210                $this->addTreeElement( $treeElement );
00211           }
00212      }
00213           
00214 
00215      
00216      function prefs_extensions( $id )
00217      {
00218           $extensions = get_loaded_extensions();
00219           asort( $extensions );
00220            
00221           foreach( $extensions as $id=>$extensionName )
00222           {
00223                $treeElement = new TreeElement();
00224                $treeElement->text       = $extensionName;
00225                $treeElement->icon       = 'config_property';
00226                $treeElement->internalId = $id;
00227                $this->addTreeElement( $treeElement );
00228           }
00229      }
00230      
00231           
00232      
00233      function prefs_extension( $id )
00234      {
00235           $extensions = get_loaded_extensions();
00236           $functions = get_extension_funcs( $extensions[$id] );
00237           asort( $functions );
00238 
00239           foreach( $functions as $functionName )
00240           {
00241                $treeElement = new TreeElement();
00242                $treeElement->text = $functionName;
00243                $treeElement->icon   = 'config_property';
00244                $this->addTreeElement( $treeElement );
00245           }
00246      }
00247      
00248           
00249      
00250      function prefs( $id )
00251      {
00252           global $conf;
00253           $conf_config = $conf['interface']['config'];
00254 
00255 
00256           $treeElement = new TreeElement();
00257           
00258           $treeElement->internalId  = 0;
00259           $treeElement->text        = 'OpenRat';
00260           $treeElement->icon        = 'config_folder';
00261 
00262           if   ( !empty($conf_config['file_manager_url']) )
00263                $treeElement->url         = $conf_config['file_manager_url'];
00264           $treeElement->target      = '_blank';
00265           $treeElement->description = '';
00266           $treeElement->type        = 'prefs_cms';
00267           $this->addTreeElement( $treeElement );
00268 
00269 
00270 
00271           if   ( !empty($conf_config['show_system']) )
00272           {
00273                $treeElement = new TreeElement();
00274                
00275                $treeElement->internalId  = 0;
00276                $treeElement->text        = lang('GLOBAL_SYSTEM');
00277                $treeElement->icon        = 'config_folder';
00278                
00279                $treeElement->description = '';
00280                $treeElement->target      = 'cms_main';
00281                $treeElement->type        = 'prefs_system';
00282                $this->addTreeElement( $treeElement );
00283           }
00284 
00285 
00286           if   ( !empty($conf_config['show_interpreter']) )
00287           {
00288                $treeElement = new TreeElement();
00289                
00290                $treeElement->internalId  = 0;
00291                $treeElement->text        = lang('GLOBAL_PHP');
00292                $treeElement->icon        = 'config_folder';
00293                
00294                $treeElement->description = '';
00295                $treeElement->target      = 'cms_main';
00296                $treeElement->type        = 'prefs_php';
00297                $this->addTreeElement( $treeElement );
00298           }
00299 
00300 
00301           if   ( !empty($conf_config['show_extensions']) )
00302           {
00303                $treeElement = new TreeElement();
00304                
00305                $treeElement->internalId  = 0;
00306                $treeElement->text        = lang('GLOBAL_EXTENSIONS');
00307                $treeElement->icon        = 'config_folder';
00308                
00309                $treeElement->description = '';
00310                $treeElement->target      = 'cms_main';
00311                $treeElement->type        = 'prefs_extensions';
00312                $this->addTreeElement( $treeElement );
00313           }
00314      }
00315 
00316 
00317      function prefs_cms( $id )
00318      {
00319           global $conf;
00320           
00321           if   ( $id == 0 )
00322           {
00323                $tmpConf = $conf;
00324           }
00325           else
00326                $tmpConf = $this->confCache[$id];
00327           
00328           foreach( $tmpConf as $key=>$value )
00329           {
00330                if   ( is_array($value) )
00331                {
00332                     $this->confCache[crc32($key)] = $value;
00333 
00334                     $treeElement = new TreeElement();
00335                     
00336                     $treeElement->internalId  = crc32($key);
00337                     $treeElement->text        = $key;
00338 //                  if   ( $id == 0 )
00339 //                       $treeElement->url         = Html::url('main','prefs',0,array('conf'=>$key));
00340                     $treeElement->icon        = 'config_folder';
00341                     
00342                     $treeElement->description = count($value).' '.lang('SETTINGS');
00343                     $treeElement->target      = 'cms_main';
00344                     $treeElement->type        = 'prefs_cms';
00345                     $this->addTreeElement( $treeElement );
00346                }
00347                else
00348                {
00349                     if   ( is_bool($value))
00350                          $value = $value ? lang('IS_YES') : lang('IS_NO');
00351                     elseif    ( is_numeric($value))
00352                          $value = ($value>0?'':'').$value;
00353                     else
00354                          $value = $conf['html']['speech_open'].htmlentities(Text::maxLength($value,30)).$conf['html']['speech_close'];
00355                          
00356                     $this->confCache[crc32($key)] = $value;
00357 
00358                     $treeElement = new TreeElement();
00359                     
00360                     $treeElement->text        = $key.'=';
00361                     if   ( $key != 'password')
00362                          $treeElement->text .= $value;
00363                     else
00364                          $treeElement->text .= '*';
00365                          
00366                     $treeElement->icon        = 'config_property';
00367                     
00368 //                  if   ( $key != 'password')
00369 //                       $treeElement->description = $value;
00370                     $treeElement->description = lang('SETTING').' '.$key;
00371                          
00372                     $this->addTreeElement( $treeElement );
00373                }
00374           }
00375      }
00376 
00377 
00378      function users( $id )
00379      {    
00380           foreach( User::getAllUsers() as $user )
00381           {
00382                $treeElement = new TreeElement();
00383                
00384                $treeElement->internalId  = $user->userid;
00385                $treeElement->text        = $user->name;
00386                $treeElement->url         = Html::url('main','user',
00387                                                      $user->userid,array(REQ_PARAM_TARGETSUBACTION=>'edit') );
00388                $treeElement->icon        = 'user';
00389                
00390                $desc =  $user->fullname;
00391 
00392                if   ( $user->isAdmin )
00393                     $desc .= ' ('.lang('USER_ADMIN').') ';
00394                if   ( $user->desc == "" )
00395                     $desc .= ' - '.lang('GLOBAL_NO_DESCRIPTION_AVAILABLE');
00396                else
00397                     $desc .= ' - '.$user->desc;
00398 
00399                $treeElement->description = $desc;
00400                $treeElement->target      = 'cms_main';
00401 
00402                $this->addTreeElement( $treeElement );
00403           }
00404      }
00405 
00406 
00407      function groups( $id )
00408      {
00409 
00410           foreach( Group::getAll() as $id=>$name )
00411           {
00412                $treeElement = new TreeElement();
00413                
00414                $g = new Group( $id );
00415                $g->load();
00416 
00417                $treeElement->internalId  = $id;
00418                $treeElement->text        = $g->name;
00419                $treeElement->url         = Html::url('main','group',$id,
00420                                                      array(REQ_PARAM_TARGETSUBACTION=>'edit') );
00421                $treeElement->icon        = 'group';
00422                $treeElement->description = lang('GLOBAL_GROUP').' '.$g->name.': '.implode(', ',$g->getUsers());
00423                $treeElement->target      = 'cms_main';
00424                $treeElement->type        = 'userofgroup';
00425 
00426                $this->addTreeElement( $treeElement );
00427           }
00428      }
00429 
00430 
00431      function userofgroup( $id )
00432      {
00433           $g = new Group( $id );
00434 
00435           foreach( $g->getUsers() as $id=>$name )
00436           {
00437                $treeElement = new TreeElement();
00438                
00439                $u = new User( $id );
00440                $u->load();
00441                $treeElement->text        = $u->name;
00442                $treeElement->url         = Html::url('main','user',$id);
00443                $treeElement->icon        = 'user';
00444                $treeElement->description = $u->fullname;
00445                $treeElement->target      = 'cms_main';
00446 
00447                $this->addTreeElement( $treeElement );
00448           }
00449      }
00450 }
00451 
00452 ?>

Erzeugt am Thu May 14 00:55:49 2009 für OpenRat von  doxygen 1.5.8