source: branches/2.5/admin/navbar-sel.php @ 5509

Revision 5509, 2.8 KB checked in by gustavo, 12 years ago (diff)

Ticket #2488 - Adicionar cabecalho de licenca em arquivos que nao o possuem

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2                /***************************************************************************
3                * Expresso Livre                                                           *
4                * http://www.expressolivre.org                                             *
5                * --------------------------------------------                             *
6                *  This program is free software; you can redistribute it and/or modify it *
7                *  under the terms of the GNU General Public License as published by the   *
8                *  Free Software Foundation; either version 2 of the License, or (at your  *
9                *  option) any later version.                                              *
10                \**************************************************************************/
11               
12//
13// SourceForge Knowledge Base Module v.1.0.0
14//
15// Created by Patrick Walsh (pjw@users.sourceforge.net) 6/00
16// Copyright (c) ... aw, hell, copy all the code you want
17//
18
19/*
20        This code was adapted from Rasmus Lerdorf's article on PHPBuilder
21        http://www.phpbuilder.com/columns/rasmus19990124.php3
22*/
23
24function openGif($filename) {
25
26        if (!$filename) { $filename = "navbar.gif"; }
27        $im = @imagecreatefromgif($filename);
28        if ($im == "") { /* test for success of file creation */
29                $im = imagecreate(300,15); /* Create a blank image */
30                $bgc = imagecolorallocate($im, 255, 255, 255);
31                $tc = imagecolorallocate($im, 0, 0, 0);
32                imagefilledrectangle($im, 0, 0, 300, 15, $bgc);
33                imagestring($im,1,2,2,"Error loading $filename", $tc);
34        }
35        return $im;
36}
37
38function getRGB($web_color) {
39        if (strlen($web_color) != 6) {
40                return false;
41        } else {
42                $retval["r"] = hexdec(substr($web_color,0,2));
43                $retval["g"] = hexdec(substr($web_color,2,2));
44                $retval["b"] = hexdec(substr($web_color,4,2));
45                return $retval;
46        }
47}
48  $phpgw_info = array();
49  $phpgw_info["flags"]["currentapp"] = "admin";
50  $phpgw_info["flags"]["nonavbar"] = True;
51  $phpgw_info["flags"]["noheader"] = True;
52  include("../header.inc.php");
53
54       
55  Header( "Content-type: image/gif");
56
57  $border = 1;
58
59//echo $filename;
60  $im = openGif($filename); /* Open the provided file */
61  $bg = getRGB($phpgw_info["theme"]["navbar_bg"]); /* get navbar theme */
62  $fg = getRGB($phpgw_info["theme"]["navbar_text"]);
63  $navbar_bg = ImageColorAllocate($im, $bg["r"], $bg["g"], $bg["b"]);
64  $navbar_fg = ImageColorAllocate($im, $fg["r"], $fg["g"], $fg["b"]);
65
66  $dk_gray = ImageColorAllocate($im, 128, 128, 128);
67  $lt_gray = ImageColorAllocate($im, 192, 192, 192);
68
69  $dx = ImageSX($im);  /* get image size */
70  $dy = ImageSY($im);
71
72  ImageFilledRectangle($im,0, 0, $dx, $border,$dk_gray); /* top */
73  ImageFilledRectangle($im,0, 0, $border, $dy,$dk_gray); /* left */
74  ImageFilledRectangle($im,$dx-$border-1, 0, $dx, $dy,$lt_gray); /* right */
75  ImageFilledRectangle($im,0, $dy-$border-1, $dx, $dy,$lt_gray); /* bottom */
76
77  //ImageGif($im,"$DOCUMENT_ROOT/kb/xml/$filename");
78
79  ImageGif($im);
80       
81  ImageDestroy($im);
82?>
83
Note: See TracBrowser for help on using the repository browser.