Ignore:
Timestamp:
Aug 31, 2008, 10:54:39 PM (16 years ago)
Author:
vdigital
Message:
  • Configuration reversed to simplify CSS
  • theme.css a test to solve menubar issue
  • STC: php version control
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/SwiftThemeCreator/theme_creator.php

    r2487 r2492  
    258258   */
    259259  $main['subphase'] = 'fixed background controls';
     260  if (isset($_POST['picture_url'])) $main['picture_url'] = $_POST['picture_url'];
     261  if (isset($_POST['background_mode']))
     262      $main['background_mode'] = $_POST['background_mode']; 
    260263  if (isset($_POST['background'])) $main['background'] = $_POST['background'];
    261264  // Fixed
    262   if ( $main['background'] == 'fixed' and isset($_POST['picture_url'])) {
    263     if ( is_dir($_POST['picture_url'])
    264         or !is_file($_POST['picture_url']) )
     265  if ( $main['background'] == 'fixed') {
     266    if ( is_dir($main['picture_url'])
     267        or !is_file($main['picture_url']) )
    265268      array_push($errors, l10n('Header picture is not found, check its path and name.'));
    266     $extension = substr($_POST['picture_url'],strrpos($_POST['picture_url'],'.')+1);
     269    $extension = substr($main['picture_url'],strrpos($main['picture_url'],'.')+1);
    267270    if (!in_array($extension, array('jpg','jpeg','png')))
    268271      array_push($errors, l10n('Compliant extensions are .jpg, .jpeg or .png.'));
     
    316319// +-----------------------------------------------------------------------+
    317320$main['phase'] = 'Files building';
     321if (!function_exists('imagecreatetruecolor') or !function_exists('imagefilter')) {
     322  array_push($errors, l10n('Some Php Graphic resources are missing.'
     323        . ' Sorry for the inconvenience, but Swift Theme Creator couldn\'t work in such case.'));
     324  array_push($infos, l10n('This plugin requires PHP 5.2.5 or later'
     325        . ' and compiled against graphic library GD 2.0.1 or later.'));
     326  array_push($infos, l10n('On this server, PHP is:'). phpversion());
     327  if (function_exists('gd_info')) {
     328    $GD = gd_info();           
     329    array_push($infos, l10n('and graphic library is:').$GD['GD Version']);
     330  }
     331  else array_push($infos, l10n('graphic library version is not available.'));
     332  $main['background'] = 'off';
     333}
    318334if ((isset($_POST['submit']) or $main['simulate'] ) and (!is_adviser()))
    319335{
     
    388404         ORDER BY RAND(' . $main['random'] . ')
    389405         LIMIT 0,1');
    390       if($result) list($main['pic_path']) = mysql_fetch_array($result);
    391       else $main['pic_path'] =
    392            PHPWG_ROOT_PATH . 'plugins/SwiftThemeCreator/simul/header.jpg';
    393       $main['pic_ext'] = substr($main['pic_path'],strrpos($main['pic_path'],'.')+1);
    394       if ($main['pic_ext']=='png')
    395         $img = imagecreatefrompng($main['pic_path']);
    396       elseif (in_array($main['pic_ext'],array('jpg','jpeg')))
    397               $img = imagecreatefromjpeg($main['pic_path']);
    398       else $img = imagecreatefromjpeg(PHPWG_ROOT_PATH
    399                    . 'plugins/SwiftThemeCreator/simul/header.jpg');
    400       imagejpeg( $img, $themedir . '/header.jpg', 90 );
    401       imagedestroy ($img);
     406        if($result) list($main['pic_path']) = mysql_fetch_array($result);
     407        else $main['pic_path'] =
     408             PHPWG_ROOT_PATH . 'plugins/SwiftThemeCreator/simul/header.jpg';
     409        $main['pic_ext'] = substr($main['pic_path'],strrpos($main['pic_path'],'.')+1);
     410        if ($main['pic_ext']=='png')
     411          $img = imagecreatefrompng($main['pic_path']);
     412        elseif (in_array($main['pic_ext'],array('jpg','jpeg')))
     413                $img = imagecreatefromjpeg($main['pic_path']);
     414        else $img = imagecreatefromjpeg(PHPWG_ROOT_PATH
     415                     . 'plugins/SwiftThemeCreator/simul/header.jpg');
     416        imagejpeg( $img, $themedir . '/header.jpg', 90 );
     417        imagedestroy ($img);
    402418      }
    403419      if (isset($_POST['background']) and $_POST['background'] == 'fixed')
    404420      {
    405         if (function_exists('imagecreatefromjpeg'))
    406         {
    407           $hdr = imagecreatetruecolor ($main['picture_width'], $main['picture_height']);
    408           imagecolorset ( $hdr, 0, $r2, $g2, $b2 );
    409           if ($extension == 'png') $img = imagecreatefrompng($_POST['picture_url']);
    410           else $img = imagecreatefromjpeg($_POST['picture_url']);
    411           imagecopymerge ( $hdr, $img, 0, 0, 0, 0, $main['picture_width'], $main['picture_height'], 60 );
    412           imagedestroy ($img);
    413           if ($main['colorize']) imagefilter($hdr, IMG_FILTER_COLORIZE, $r, $g, $b);
    414           if ($main['brightness']) imagefilter($hdr, IMG_FILTER_BRIGHTNESS, $delta);
    415           if ($main['contrast']) imagefilter($hdr, IMG_FILTER_CONTRAST, 20);
    416           imagejpeg( $hdr, $themedir . '/header.jpg', 90 );
     421        $main['subphase'] = 'Fixed background';
     422        $hdr = imagecreatetruecolor ($main['picture_width'], $main['picture_height']);
     423        imagecolorset ( $hdr, 0, $r2, $g2, $b2 );
     424        if ($extension == 'png') $img = imagecreatefrompng($main['picture_url']);
     425        else $img = imagecreatefromjpeg($main['picture_url']);
     426        imagecopymerge ( $hdr, $img, 0, 0, 0, 0, $main['picture_width'], $main['picture_height'], 60 );
     427        imagedestroy ($img);
     428        if ($main['colorize']) imagefilter($hdr, IMG_FILTER_COLORIZE, $r, $g, $b);
     429        if ($main['brightness']) imagefilter($hdr, IMG_FILTER_BRIGHTNESS, $delta);
     430        if ($main['contrast']) imagefilter($hdr, IMG_FILTER_CONTRAST, 20);
     431        imagejpeg( $hdr, $themedir . '/header.jpg', 90 );
    417432          imagedestroy ($hdr);
    418         }
    419         else @copy( $_POST['picture_url'], $themedir . '/header.jpg');     
    420433      }
    421434      /*
    422435       * Build background image for titrePage or definition list (in #menubar)
    423436       **/
    424       if (function_exists('imagecreatefrompng'))
    425       {
    426         $hdr = imagecreatetruecolor (1, 38);
    427         imagecolorset ( $hdr, 0, $r2, $g2, $b2 );
    428         $img = imagecreatefrompng(STC_PATH . '/titrePage-bg.png');
    429         imagecopymerge ( $hdr, $img, 0, 0, 0, 0, 1, 38, 60 );
    430         imagedestroy ($img);
    431         if ($main['colorize']) imagefilter($hdr, IMG_FILTER_COLORIZE, $r, $g, $b);
    432         if ($main['brightness']) imagefilter($hdr, IMG_FILTER_BRIGHTNESS, $delta);
    433         if ($main['contrast']) imagefilter($hdr, IMG_FILTER_CONTRAST, 20);
    434         imagepng( $hdr, $themedir . '/stc.png', 9 );
    435         imagedestroy ($hdr);
    436       }
    437       else @copy( STC_PATH
    438                  . '/titrePage-bg.png', $themedir . '/stc.png');     
     437      $main['subphase'] = 'Headbars background';
     438      $hdr = imagecreatetruecolor (1, 38);
     439      imagecolorset ( $hdr, 0, $r2, $g2, $b2 );
     440      $img = imagecreatefrompng(STC_PATH . '/titrePage-bg.png');
     441      imagecopymerge ( $hdr, $img, 0, 0, 0, 0, 1, 38, 60 );
     442      imagedestroy ($img);
     443      if ($main['colorize']) imagefilter($hdr, IMG_FILTER_COLORIZE, $r, $g, $b);
     444      if ($main['brightness']) imagefilter($hdr, IMG_FILTER_BRIGHTNESS, $delta);
     445      if ($main['contrast']) imagefilter($hdr, IMG_FILTER_CONTRAST, 20);
     446      imagepng( $hdr, $themedir . '/stc.png', 9 );
     447      imagedestroy ($hdr);
     448
     449      /*
     450       * Errors and cleaning or Congratulations
     451       **/
     452      $main['phase'] = 'Congratulation';
     453      $main['subphase'] = 'cleaning';
    439454      if ($rfs == false) {
    440455        array_push($errors,
     
    508523    'fixed' => l10n('Fixed URL'),
    509524  ));
    510 $main['picture_url'] = PHPWG_ROOT_PATH . 'plugins/SwiftThemeCreator/sample.jpg';
    511 if (isset($swift_theme_creator->picture_url))
    512     $main['picture_url'] = $swift_theme_creator->picture_url;
    513 if (isset($_POST['picture_url'])) $main['picture_url'] = $_POST['picture_url'];
    514 
    515 if (isset($_POST['picture_width']))
    516     $main['picture_width'] = $_POST['picture_width'];
    517 if (isset($_POST['picture_height']))
    518     $main['picture_height'] = $_POST['picture_height'];
    519 
    520 if (isset($_POST['background_mode']))
    521       $main['background_mode'] = $_POST['background_mode'];
    522525$template->assign('background_mode_options',
    523526  array(
Note: See TracChangeset for help on using the changeset viewer.