home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / classes / theme.class.inc < prev    next >
Text File  |  2004-03-08  |  2KB  |  82 lines

  1. <?php
  2. /*
  3. Copyright Intermesh 2003
  4. Author: Merijn Schering <mschering@intermesh.nl>
  5. Version: 1.0 Release date: 08 July 2003
  6.  
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.
  11. */
  12.  
  13. class GO_THEME
  14. {
  15.     var $theme;
  16.     var $default_theme;
  17.     var $image_url;
  18.     var $theme_path;
  19.     var $theme_url;
  20.     var $stylesheet;
  21.     var $path_to_themes;
  22.     var $images = array();
  23.     var $sounds = array();
  24.  
  25.     function GO_THEME()
  26.     {
  27.         global $GO_CONFIG;
  28.         $this->path_to_themes = $GO_CONFIG->root_path.$GO_CONFIG->theme_path.$GO_CONFIG->slash;
  29.         if ($GO_CONFIG->slash == '\\')
  30.         {
  31.             $this->url_to_themes = str_replace('\\', '', $GO_CONFIG->host.$GO_CONFIG->theme_path.$GO_CONFIG->slash);
  32.         }else
  33.         {
  34.             $this->url_to_themes = $GO_CONFIG->host.$GO_CONFIG->theme_path.$GO_CONFIG->slash;
  35.         }
  36.  
  37.         $this->default_theme = $GO_CONFIG->theme;
  38.         $_SESSION['GO_SESSION']['theme'] = isset($_SESSION['GO_SESSION']['theme']) ? $_SESSION['GO_SESSION']['theme'] : $this->default_theme;
  39.  
  40.         if ($_SESSION['GO_SESSION']['theme'] != '' && file_exists($this->path_to_themes.$_SESSION['GO_SESSION']['theme']))
  41.         {
  42.             $this->theme = $_SESSION['GO_SESSION']['theme'];
  43.         }else
  44.         {
  45.             $_SESSION['GO_SESSION']['theme'] = $this->default_theme;
  46.             $this->theme = $this->default_theme;
  47.         }
  48.  
  49.         $this->theme_path = $this->path_to_themes.$this->theme.$GO_CONFIG->slash;
  50.         $this->theme_url = $this->url_to_themes.$this->theme.'/';
  51.         $this->image_url = $this->theme_url.'images/';
  52.         $this->stylesheet = $this->theme_url."style.css";
  53.         require($this->theme_path.'images.inc');
  54.         foreach($images as $key => $value)
  55.         {
  56.             $this->images[$key] = $this->image_url.$value;
  57.         }
  58.         require($this->theme_path.'sounds.inc');
  59.         foreach($sounds as $key => $value)
  60.         {
  61.             $this->sounds[$key] = $this->theme_url.'sounds/'.$value;
  62.         }
  63.     }
  64.  
  65.     //gets the themes
  66.     function get_themes()
  67.     {
  68.         //$location = $SCRIPT_FILENAME."languages";
  69.         $theme_dir=opendir($this->path_to_themes);
  70.         while ($file=readdir($theme_dir))
  71.         {
  72.             //Couldn't get is_file to work right so i worked around
  73.             if (is_dir($this->path_to_themes.$file) && $file != "." && $file != ".." && $file != 'CVS')
  74.             {
  75.                   $themes[] = $file;
  76.             }
  77.         }
  78.         closedir($theme_dir);
  79.         return $themes;
  80.     }
  81. }
  82. ?>