Implement conference specific logos

This commit is contained in:
james 2010-06-09 20:24:52 +00:00
parent 703cc18425
commit 86a43e909a
3 changed files with 65 additions and 59 deletions

View File

@ -416,6 +416,7 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false)
global $HEADER_SENT; global $HEADER_SENT;
global $config; global $config;
global $prependdir; global $prependdir;
global $conference;
//do this so we can use send_header() a little more loosly and not worry about it being sent more than once. //do this so we can use send_header() a little more loosly and not worry about it being sent more than once.
if($HEADER_SENT) return; if($HEADER_SENT) return;
@ -449,7 +450,9 @@ if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config")
<div id="notice_area" class="notice_area"></div> <div id="notice_area" class="notice_area"></div>
<div id="header"> <div id="header">
<? <?
if(file_exists($prependdir."data/logo-100.gif")) if(file_exists($prependdir."data/{$conference['id']}-logo-100.gif"))
echo "<img align=\"left\" height=\"50\" src=\"".$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-100.gif\">";
else if(file_exists($prependdir."data/logo-100.gif"))
echo "<img align=\"left\" height=\"50\" src=\"".$config['SFIABDIRECTORY']."/data/logo-100.gif\">"; echo "<img align=\"left\" height=\"50\" src=\"".$config['SFIABDIRECTORY']."/data/logo-100.gif\">";
if(!$_SESSION['conferenceid']) { if(!$_SESSION['conferenceid']) {
@ -581,7 +584,7 @@ if($_SESSION['users_type'] == 'committee') {
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_personal.php\">".i18n("My Profile").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_personal.php\">".i18n("My Profile").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committee_main.php\">".i18n("Committee Home").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committee_main.php\">".i18n("Committee Home").'</a></li>';
if(committee_auth_has_access("admin")){ if(committee_auth_has_access("admin")){
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/\">".i18n("Fair Administration").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/\">".i18n("Administration").'</a></li>';
} }
if(committee_auth_has_access("config")){ if(committee_auth_has_access("config")){
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/config/\">".i18n("Configuration").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/config/\">".i18n("Configuration").'</a></li>';

View File

@ -4,7 +4,7 @@
SFIAB Website: http://www.sfiab.ca SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org> Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org> Copyright (C) 2005-2010 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU General Public
@ -25,9 +25,18 @@
require_once('../common.inc.php'); require_once('../common.inc.php');
require_once('../user.inc.php'); require_once('../user.inc.php');
user_auth_required('committee', 'config'); user_auth_required('committee', 'config');
send_header("Fair Logo Image", if($conference['id']) {
$title=$conference['name']." Logo Image";
$cstr=$conference['id']."-";
}
else {
$title="Fair Logo Image";
$cstr="";
}
send_header($title,
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'SFIAB Configuration' => 'config/index.php'), 'Configuration' => 'config/index.php'),
"images"); "images");
if($_POST['action']=="addimage") { if($_POST['action']=="addimage") {
@ -37,31 +46,31 @@ if($_POST['action']=="addimage") {
// GIF or JPG or PNG // GIF or JPG or PNG
if($imagesize[2]==1 || $imagesize[2]==2 || $imagesize[2]==3) { if($imagesize[2]==1 || $imagesize[2]==2 || $imagesize[2]==3) {
echo notice(i18n("Creating sized logo files:<br />&nbsp;logo-100.gif<br />&nbsp;logo-200.gif<br />&nbsp;logo-500.gif<br />&nbsp;logo.gif")); echo notice(i18n("Creating sized logo files:<br />&nbsp;{$cstr}logo-100.gif<br />&nbsp;{$cstr}logo-200.gif<br />&nbsp;{$cstr}logo-500.gif<br />&nbsp;logo.gif"));
//Make the gif's //Make the gif's
system("convert -resize 100 \"".$_FILES['image']['tmp_name']."\" ../data/logo-100.gif"); system("convert -resize 100 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-100.gif");
system("convert -resize 200 \"".$_FILES['image']['tmp_name']."\" ../data/logo-200.gif"); system("convert -resize 200 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-200.gif");
system("convert -resize 500 \"".$_FILES['image']['tmp_name']."\" ../data/logo-500.gif"); system("convert -resize 500 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-500.gif");
system("convert \"".$_FILES['image']['tmp_name']."\" ../data/logo.gif"); system("convert \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo.gif");
if(file_exists("../data/logo-100.gif") && file_exists("../data/logo-200.gif") && file_exists("../data/logo-500.gif") && file_exists("../data/logo.gif")) if(file_exists("../data/{$cstr}logo-100.gif") && file_exists("../data/{$cstr}logo-200.gif") && file_exists("../data/{$cstr}logo-500.gif") && file_exists("../data/{$cstr}logo.gif"))
echo happy(i18n("GIF Images successfully created")); echo happy(i18n("GIF Images successfully created"));
else else
echo error(i18n("Error creating GIF Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used")); echo error(i18n("Error creating GIF Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used"));
echo notice(i18n("Creating sized logo files:<br />&nbsp;logo-100.png<br />&nbsp;logo-200.png<br />&nbsp;logo-500.png<br />&nbsp;logo.png")); echo notice(i18n("Creating sized logo files:<br />&nbsp;{$cstr}logo-100.png<br />&nbsp;{$cstr}logo-200.png<br />&nbsp;{$cstr}logo-500.png<br />&nbsp;{$cstr}logo.png"));
//make some PNG's as well //make some PNG's as well
system("convert -resize 100 \"".$_FILES['image']['tmp_name']."\" ../data/logo-100.png"); system("convert -resize 100 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-100.png");
system("convert -resize 200 \"".$_FILES['image']['tmp_name']."\" ../data/logo-200.png"); system("convert -resize 200 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-200.png");
system("convert -resize 500 \"".$_FILES['image']['tmp_name']."\" ../data/logo-500.png"); system("convert -resize 500 \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo-500.png");
system("convert \"".$_FILES['image']['tmp_name']."\" ../data/logo.png"); system("convert \"".$_FILES['image']['tmp_name']."\" ../data/{$cstr}logo.png");
if(file_exists("../data/logo-100.png") && file_exists("../data/logo-200.png") && file_exists("../data/logo-500.png") && file_exists("../data/logo.png")) if(file_exists("../data/{$cstr}logo-100.png") && file_exists("../data/{$cstr}logo-200.png") && file_exists("../data/{$cstr}logo-500.png") && file_exists("../data/{$cstr}logo.png"))
echo happy(i18n("PNG Images successfully created")); echo happy(i18n("PNG Images successfully created"));
else else
echo error(i18n("Error creating PNG Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used")); echo error(i18n("Error creating PNG Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used"));
echo notice(i18n("Creating sized logo files:<br />&nbsp;logo-100.jpg<br />&nbsp;logo-200.jpg<br />&nbsp;logo-500.jpg<br />&nbsp;logo.jpg")); echo notice(i18n("Creating sized logo files:<br />&nbsp;{$cstr}logo-100.jpg<br />&nbsp;{$cstr}logo-200.jpg<br />&nbsp;{$cstr}logo-500.jpg<br />&nbsp;{$cstr}logo.jpg"));
/* /*
We do the JPG ones with GD, so we can force the transparency layer if its converting from We do the JPG ones with GD, so we can force the transparency layer if its converting from
@ -82,17 +91,17 @@ if($_POST['action']=="addimage") {
imagecolorallocate($image100,255,255,255); imagecolorallocate($image100,255,255,255);
imagecolortransparent($image100,0); imagecolortransparent($image100,0);
imagecopyresized($image100, $image, 0, 0, 0, 0, $s, round($ratio * $s), $w, $h); imagecopyresized($image100, $image, 0, 0, 0, 0, $s, round($ratio * $s), $w, $h);
imagejpeg($image100, "../data/logo-$s.jpg",95); imagejpeg($image100, "../data/{$cstr}logo-$s.jpg",95);
imagedestroy($image100); imagedestroy($image100);
} }
$imageorig=imagecreate($w,$h); $imageorig=imagecreate($w,$h);
imagecolorallocate($imageorig,255,255,255); imagecolorallocate($imageorig,255,255,255);
imagecolortransparent($imageorig,0); imagecolortransparent($imageorig,0);
imagecopy($imageorig, $image, 0, 0, 0, 0,$w,$h); imagecopy($imageorig, $image, 0, 0, 0, 0,$w,$h);
imagejpeg($imageorig, "../data/logo.jpg",95); imagejpeg($imageorig, "../data/{$cstr}logo.jpg",95);
imagedestroy($imageorig); imagedestroy($imageorig);
if(file_exists("../data/logo-100.jpg") && file_exists("../data/logo-200.jpg") && file_exists("../data/logo-500.jpg") && file_exists("../data/logo.jpg")) if(file_exists("../data/{$cstr}logo-100.jpg") && file_exists("../data/{$cstr}logo-200.jpg") && file_exists("../data/{$cstr}logo-500.jpg") && file_exists("../data/{$cstr}logo.jpg"))
echo happy(i18n("JPG Images successfully created")); echo happy(i18n("JPG Images successfully created"));
else else
echo error(i18n("Error creating JPG Image files. You need the GD library available in PHP to make the JPG files")); echo error(i18n("Error creating JPG Image files. You need the GD library available in PHP to make the JPG files"));
@ -107,61 +116,55 @@ if($_POST['action']=="addimage") {
} }
if($_POST['action']=="delimage") { if($_POST['action']=="delimage") {
@unlink("../data/logo.gif"); @unlink("../data/{$cstr}logo.gif");
@unlink("../data/logo-100.gif"); @unlink("../data/{$cstr}logo-100.gif");
@unlink("../data/logo-200.gif"); @unlink("../data/{$cstr}logo-200.gif");
@unlink("../data/logo-500.gif"); @unlink("../data/{$cstr}logo-500.gif");
@unlink("../data/logo.png"); @unlink("../data/{$cstr}logo.png");
@unlink("../data/logo-100.png"); @unlink("../data/{$cstr}logo-100.png");
@unlink("../data/logo-200.png"); @unlink("../data/{$cstr}logo-200.png");
@unlink("../data/logo-500.png"); @unlink("../data/{$cstr}logo-500.png");
@unlink("../data/logo.jpg"); @unlink("../data/{$cstr}logo.jpg");
@unlink("../data/logo-100.jpg"); @unlink("../data/{$cstr}logo-100.jpg");
@unlink("../data/logo-200.jpg"); @unlink("../data/{$cstr}logo-200.jpg");
@unlink("../data/logo-500.jpg"); @unlink("../data/{$cstr}logo-500.jpg");
echo happy(i18n("Deleted any existing logo files")); echo happy(i18n("Deleted any existing logo files"));
} }
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">"; echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"addimage\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"addimage\">\n";
echo "<table>"; echo "<table>";
if(file_exists("../data/logo.gif")) if(file_exists("../data/{$cstr}logo.gif")) {
{
echo "<tr><td colspan=\"2\">".i18n("GIF Images")."</td></tr>"; echo "<tr><td colspan=\"2\">".i18n("GIF Images")."</td></tr>";
echo "<tr><td>"; echo "<tr><td>";
echo "<img src=\"../data/logo-100.gif\" border=\"0\">"; echo "<img src=\"../data/{$cstr}logo-100.gif\" border=\"0\">";
echo "</td><td>"; echo "</td><td>";
echo "<a target=\"_blank\" href=\"../data/logo.gif\">",i18n("Original size")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo.gif\">",i18n("Original size")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-100.gif\">".i18n("100 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-100.gif\">".i18n("100 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-200.gif\">".i18n("200 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-200.gif\">".i18n("200 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-500.gif\">500 Pixel width</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-500.gif\">500 Pixel width</a><br />";
echo "</td></tr>"; echo "</td></tr>";
} }
if(file_exists("../data/logo.png")) if(file_exists("../data/{$cstr}logo.png")) {
{
echo "<tr><td colspan=\"2\">".i18n("PNG Images")."</td></tr>"; echo "<tr><td colspan=\"2\">".i18n("PNG Images")."</td></tr>";
echo "<tr><td>"; echo "<tr><td>";
echo "<img src=\"../data/logo-100.png\" border=\"0\">"; echo "<img src=\"../data/{$cstr}logo-100.png\" border=\"0\">";
echo "</td><td>"; echo "</td><td>";
echo "<a target=\"_blank\" href=\"../data/logo.png\">",i18n("Original size")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo.png\">",i18n("Original size")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-100.png\">".i18n("100 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-100.png\">".i18n("100 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-200.png\">".i18n("200 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-200.png\">".i18n("200 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-500.png\">500 Pixel width</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-500.png\">500 Pixel width</a><br />";
echo "</td></tr>"; echo "</td></tr>";
} }
if(file_exists("../data/logo.jpg")) if(file_exists("../data/{$cstr}logo.jpg")) {
{
echo "<tr><td colspan=\"2\">".i18n("JPG Images")."</td></tr>"; echo "<tr><td colspan=\"2\">".i18n("JPG Images")."</td></tr>";
echo "<tr><td>"; echo "<tr><td>";
echo "<img src=\"../data/logo-100.jpg\" border=\"0\">"; echo "<img src=\"../data/{$cstr}logo-100.jpg\" border=\"0\">";
echo "</td><td>"; echo "</td><td>";
echo "<a target=\"_blank\" href=\"../data/logo.jpg\">",i18n("Original size")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo.jpg\">",i18n("Original size")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-100.jpg\">".i18n("100 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-100.jpg\">".i18n("100 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-200.jpg\">".i18n("200 Pixel width")."</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-200.jpg\">".i18n("200 Pixel width")."</a><br />";
echo "<a target=\"_blank\" href=\"../data/logo-500.jpg\">500 Pixel width</a><br />"; echo "<a target=\"_blank\" href=\"../data/{$cstr}logo-500.jpg\">500 Pixel width</a><br />";
echo "</td></tr>"; echo "</td></tr>";
} }
echo "<tr><td colspan=2>"; echo "<tr><td colspan=2>";
@ -171,7 +174,7 @@ if($_POST['action']=="delimage") {
echo "</table>"; echo "</table>";
echo "</form>"; echo "</form>";
if( file_exists("../data/logo.gif") || file_exists("../data/logo.png") || file_exists("../data/logo.jpg")) { if( file_exists("../data/{$cstr}logo.gif") || file_exists("../data/{$cstr}logo.png") || file_exists("../data/{$cstr}logo.jpg")) {
echo "<br />"; echo "<br />";
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">"; echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"delimage\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"delimage\">\n";

View File

@ -37,7 +37,7 @@
echo " <td><a href=\"variables.php\">".theme_icon("configuration_variables")."<br />".i18n("Configuration Variables")."</a></td>"; echo " <td><a href=\"variables.php\">".theme_icon("configuration_variables")."<br />".i18n("Configuration Variables")."</a></td>";
echo " <td><a href=\"dates.php\">".theme_icon("important_dates")."<br />".i18n("Important Dates")."</a></td>"; echo " <td><a href=\"dates.php\">".theme_icon("important_dates")."<br />".i18n("Important Dates")."</a></td>";
//echo " <td><a href=\"categories.php\">".theme_icon("project_age_categories")."<br />".i18n("Age Categories")."</a></td>"; //echo " <td><a href=\"categories.php\">".theme_icon("project_age_categories")."<br />".i18n("Age Categories")."</a></td>";
echo " <td></td>\n"; echo " <td><a href=\"images.php\">".theme_icon("images")."<br />".i18n("Images (Fair Logo)")."</a></td>";
echo " <td></td>\n"; echo " <td></td>\n";
echo " </tr>"; echo " </tr>";
echo "</table>\n"; echo "</table>\n";