PDA

View Full Version : PhotoUpload in usercp with template use !


bommelchen
08-27-2002, 07:17 PM
Hello @all,
I have integrated the PhotoUpload Hack in the UserCP and its work :) but i have a Problem with my reselution. The Error handling !!!

I search for a resolution to display the ErrorMessages in the Template.

here are my File Changes in Upload.php
search for this:require($DOCUMENT_ROOT . "/vb/global.php");and replace with this:$templatesused = 'usercpnav,photoupload_main,photoupload_redirect_u pdate';
require("./global.php");

$cpnav = array();
$cpmenu = array();


$cpnav[1]="#1C5780";
$cpnav[2]="#1C5780";
$cpnav[3]="#1C5780";
$cpnav[4]="#1C5780";
$cpnav[5]="#1C5780";
$cpnav[6]="#1C5780";
$cpnav[7]="#1C5780";
$cpnav[8]="#13486D";
$cpmenu[8]="class=\"fjsel\" selected";

eval("\$cpnav = \"".gettemplate("usercpnav")."\";");now search for this: echo"<html><head><title>$username's Picture Upload Utility</title></head></html>";
echo"<TABLE cellSpacing=0 width=\"100%\" align=center border=0 bordercolordark=\"#000000\" cellpadding=\"0\">";
echo"<TBODY><tr><TD bgColor=#000000><TABLE align=center bgColor=#FFFFFF border=1 cellPadding=0 cellSpacing=0 width=\"100%\" bordercolor=\"#FFFFFF\" bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\">";
echo"<TBODY><TR vAlign=top><TD vAlign=top align=middle><TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width=\"100%\" bgColor=#ffffff borderColorLight=#000000 border=1 height=\"188\"></TABLE>";
echo"<table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"\0\" height=\"17\" bordercolorlight=\"#000000\" bordercolor=\"#000000\" bordercolordark=\"$headcolor\" bgcolor=\"$headcolor\"><tr>";
echo"<TD bgcolor=\"$headcolor\" bordercolor=\"$headcolor\" bordercolorlight=\"$headcolor\" bordercolordark=\"$headcolor\" height=17><table border=0 width=100% cellspacing=0 cellpadding=0><tr><td width=33%><b><font face=\"$font\" color=\"$headcolortext\" size=$smallerfontsize>&nbsp;Photo Upload Information</font></b></td><td width=64%></td><td width=3%><a href=$cpurl/usercp.php?><img border=0 src=images/upload_files/profile.gif width=15 height=14 alt=\"Click here to view your profile control panel.\"></a>&nbsp;&nbsp;<a href=userhelp.htm onclick=\"window.open(this.href,'name','225','225','yes');re turn false\"><img border=0 src=images/upload_files/question.jpg width=18 height=19 alt=\"Click here to view a user manual, if you are not for sure about something.\"></a></td></tr></table>";
echo"</tr></table><TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width=\"100%\" bgColor=#ffffff borderColorLight=#000000 border=1><tr><td><table class=\"reg\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\"><tr><td>";
echo"<font face=\"$font\" size=\"$smallerfontsize\">$welcome</font>";
echo"</td></tr><tr vAlign=\"top\"><font face=\"$font\" size=\"$largerfontsize\"><td></font></td></tr></table></td>";
echo"</tr></TABLE><br><table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" height=\"17\" bordercolorlight=\"#000000\" bordercolor=\"#000000\" bordercolordark=\"$headcolor\" bgcolor=\"$headcolor\">";
echo"<tr><TD bgcolor=\"$headcolor\" bordercolor=\"$headcolor\" bordercolorlight=\"$headcolor\" height=\"17\"><b><font color=\"#FFFFFF\" face=\"$font\" size=\"$smallerfontsize\">&nbsp;Photo Upload</font></b></TD></tr></table>";
echo"<TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width=\"100%\" bgColor=#ffffff borderColorLight=#000000 border=1><tr><td><table class=\"reg\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\"><tr><td><table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#FFFFFF\">";
echo"<tr><td width=\"50%\" bgcolor=\"$headcolor\" bordercolor=\"$headcolor\" bordercolorlight=\"$headcolor\" bordercolordark=\"#000000\"><font face=\"$font\" size=\"$largerfontsize\"><b>&nbsp;<font color=\"#FFFFFF\">Photo Information</font></b></font></td>";
echo"<td width=\"50%\" bgcolor=\"$headcolor\" bordercolor=\"$headcolor\" bordercolorlight=\"$headcolor\" bordercolordark=\"#000000\"><font face=\"$font\" size=\"$largerfontsize\"><b>&nbsp;<font color=\"#FFFFFF\">Upload Form</font></b></font></td></tr><tr><td width=\"50%\" bordercolor=\"#000000\" valign=\"top\"><p align=\"center\"><br>" . $Warning . "<br><br>" . $the_void . "<br><br>" . $rambo . "</td><td width=\"50%\" bordercolor=\"#000000\" valign=\"top\">";
echo"<table border=\"1\" width=\"100%\" cellpadding=\"5\"><tr><td width=\"100%\" valign=\"top\" bordercolor=\"#000000\">";
echo"<form ENCTYPE=\"multipart/form-data\" method=\"post\"><font face=\"$font\" size=\"$smallerfontsize\" color=\"$headcolor\">Upload a Photo</font><br>";
echo"<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\">";
echo"<input type=\"File\" name=\"picture\" size=\"40\" maxlength=\"80\"><br>";
echo"<font face=\"$font\" size=\"$smallerfontsize\" color=\"$headcolor\">Photo Description</font><br><TEXTAREA Rows=\"10\" COLS=\"30\" NAME=\"photodesc\"></TEXTAREA> <input type=\"submit\" name=\"update_desc\" value=\"Description\"><br>";
echo"<input type=\"submit\" name=\"submit\" value=\"Upload\"> <input type=\"submit\" name=\"del_pic\" value=\"Delete\"></form>";
echo"</td></tr><tr><td width=\"100%\" valign=\"top\" bordercolor=\"#000000\"><font face=\"$font\" size=\"$smallerfontsize\" color=\"#000000\">Your Current File Is :</font><font face=\"$font\" size=\"$smallerfontsize\" color=\"$infocolor\"> $alphabravo</font><br><br><font face=\"$font\" size=\"$smallerfontsize\" color=\"#000000\">Photo Description :</font><font face=\"$font\" size=\"$smallerfontsize\" color=\"$infocolor\"> $spillthebeans</font><br><font face=\"$font\" size=\"$smallerfontsize\" color=\"#000000\">Last Updated :</font><font face=\"$font\" size=\"$smallerfontsize\" color=\"$infocolor\"> $pic_lastupdated&nbsp;@&nbsp;$time4lastupdate</font>";
echo"</td></tr></table></td></tr></table></td></tr><tr vAlign=\"top\"><font face=\"$font\" size=\"$largerfontsize\"><td>";
echo"</font></td></tr></table></td></tr></TABLE></table></table>";
echo"<table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"\0\" height=\"17\" bordercolorlight=\"#000000\" bordercolor=\"#000000\" bordercolordark=\"$headcolor\" bgcolor=\"$headcolor\"><tr><TD bgcolor=\"$headcolor\" bordercolor=\"$headcolor\" bordercolorlight=\"$headcolor\" height=\"17\"><b><font color=\"#FFFFFF\" face=\"$font\" size=\"$smallerfontsize\">&nbsp;Error Messages:</font></b>";
echo"</TD></tr></table><TABLE borderColor=#000000 cellSpacing=0 borderColorDark=#ffffff cellPadding=5 width=\"100%\" bgColor=#ffffff borderColorLight=#000000 border=1><tr><td><table class=\"reg\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\"><tr><td>";
echo"<font face=\"$font\" size=\"$smallerfontsize\">"; and replace with: if ($action == "") {
eval("dooutput(\"".gettemplate("photoupload_main")."\");");
}
if ($action == "update") {
eval("dooutput(\"".gettemplate("photoupload_redirect_update")."\");");
}save and upload the Upload.php
then create to Templates. The first one is the Photoupload_main with the folling Context:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>$bbtitle - Foto Upload</title>
$headinclude
</head>
<body>
$header

<!-- breadcrumb -->
<table cellpadding="2" cellspacing="0" border="0" width="95%" align="center">
<tr>
<td width="100%"><img src="https://vborg.vbsupport.ru/images/vb_bullet.gif" align="middle" alt="vBulletin">
<normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a> &gt;
<a href="usercp.php?s=$session[sessionhash]">Kontrollzentrum von $bbuserinfo[username]</a> &gt;
Foto Upload</b></normalfont></td>
</tr>
</table>
<!-- /breadcrumb -->

<br>
$cpnav
<br>

<table cellpadding="0" cellspacing="0" border="0" bgcolor="#0A293E" width="95%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<!-- *** -->
<tr>
<td bgcolor="#1D6AA0" align="left"><normalfont><b>$bbuserinfo[username]'s
Foto Upload Informationen</b></normalfont></td>
<td bgcolor="#1D6AA0" align="right"><normalfont><b><a href=uploadhelp.html onclick="window.open(this.href,'name','225','225','yes');re turn false"><img border=0 src=images/upload_files/question.jpg width=18 height=19 alt="Click here to view a user manual, if you are not for sure about something."></a></b></normalfont></td>

</tr>
<!-- *** -->
<tr>
<td bgcolor="#13486D" colspan="2"><normalfont>
<smallfont>$welcome</smallfont></normalfont></td>
</tr>

<tr>
<td width="50%" bgcolor="#1D6AA0"><normalfont><b>Foto Information</normalfont></b></font></td>
<td width="50%" bgcolor="#1D6AA0"><normalfont><b>Upload Formular</normalfont></b></font></td>
</tr>

<tr>
<td width="50%" bgcolor="#1C5780"><p align="center"><smallfont color="red"><b>$Warning</b></smallfont><br><br><smallfont><b>$the_void<br><br>$rambo<br></b></smallfont></td>
<td width="100%" bgcolor="#1C5780">
<form action="upload.php" ENCTYPE="multipart/form-data" method="post"><smallfont>hochzuladenes Foto</smallfont><br>
<input type="hidden" name="action" value="update">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input type="File" name="picture" size="40" maxlength="80"><br>
<smallfont>Foto Beschreibung</smallfont>
<br>
<TEXTAREA Rows="10" COLS="30" NAME="photodesc"></TEXTAREA>
<input type="submit" name="update_desc" value="Beschreibung"><br>
<input type="submit" name="submit" value="Upload">
<input type="submit" name="del_pic" value="l?schen">
</form></td>
</tr>

<tr>
<td align="center" width="100%" colspan="2" bgcolor="#13486D"><smallfont>Das momentane File ist : </smallfont><smallfont color="red"><b>$alphabravo</b></smallfont><br>
<smallfont>Foto Beschreibung : </smallfont><smallfont color="red"><b>$spillthebeans</b></smallfont><br>
<smallfont>Letztes Update : </smallfont><smallfont color="red"><b>$pic_lastupdated&nbsp;@&nbsp;$time4lastupdate</b>$error_msg $willi</smallfont></td>
</tr>

</table>
</table>

$footer

</body>
</html>and the second one is the photoupload_redirect_update withe the context:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML> <HEAD>
<TITLE>$bbtitle - Foto Upload - redirect</title>
<meta http-equiv="Refresh" content="2; URL=$cpurl/upload.php"><body>
$headinclude </head><body> <br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="95%" align="center">
<tr align="center" valign="middle">
<td>
<table border="0" cellspacing="0" cellpadding="10" bgcolor="#0E3652" width="70%">
<tr>
<td>
<div align="center">
<p><b>Daten wurden aktualisiert</b><normalfont><b>.</b><br>
<br>
</normalfont><smallfont> <a href="$cpurl/upload.php">Wenn Du nicht l&auml;nger
warten m&ouml;chtest, dann dr&uuml;cke hier <br>
(ebenfalls, wenn Dich Dein Browser nicht automatisch weiterleitet).</a>
</smallfont></p>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>Thats all for this !!! But what is with the Errorhandling?

Any Idear to complete this way?

Greeting Bommelchen