ChangeSet ID: 30888 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/01/17 20:38:18
Modified files: include : application.php version.php Added files: . : contact.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Allow contacting maintainers through a form, so their e-mail address is not exposed
Patch: http://cvs.winehq.org/patch.py?id=30888
Old revision New revision Changes Path Added 1.1 +0 -0 appdb/contact.php 1.85 1.86 +3 -1 appdb/include/application.php 1.95 1.96 +2 -1 appdb/include/version.php
Index: appdb/contact.php diff -u -p /dev/null appdb/contact.php:1.1 --- /dev/null 18 Jan 2007 2:38:18 -0000 +++ appdb/contact.php 18 Jan 2007 2:38:18 -0000 @@ -0,0 +1,75 @@ +<?php + +require_once("path.php"); +require_once(BASE."/include/incl.php"); + +/** + * Page containing a form for sending e-mail + * + */ + +$oUser = new User($_SESSION['current']->iUserId); + +/* Restrict error to logged-in users */ +if(!$oUser->isLoggedIn()) + util_show_error_page_and_exit("You need to be logged in."); + + +$oRecipient = new User($aClean['iRecipientId']); + +if(!User::exists($oRecipient->sEmail)) + util_show_error_page_and_exit("User not found"); + +/* Check for errors */ +if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit']) +{ + $error = "<font color=\"red\">Please enter both a subject and a ". + "message.</font>"; + $aClean['sSubmit'] = ""; +} + +/* Display the feedback form if nothing else is specified */ +if(!$aClean['sSubmit']) +{ + apidb_header("E-mail $oRecipient->sRealname"); + echo html_frame_start("Send us your suggestions",400,"",0); + + echo $error; + echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">"; + echo "<p>E-mail $oRecipient->sRealname.</p>"; + echo html_table_begin("width\"100%\" border=\"0\" cellpadding=\"2\"". + "cellspacing=\"2\""); + echo html_tr(array( + array("Subject", ""), + "<input type=\"text\" name=\"sSubject\" size=\"71\" />"), + "color4"); + echo html_tr(array( + array("Message", "valign=\"top\""), + "<textarea name=\"sMessage\" rows=\"15\" cols=\"60\"></textarea>"), + "color4"); + echo html_tr(array( + "", + "<input type=\"submit\" value=\"Submit\" name=\"sSubmit\" />") + ); + + echo "<input type=\"hidden\" name=\"iRecipientId\" ". + "value=\"$oRecipient->iUserId\" />"; + + echo html_table_end(); + echo "</form>\n"; + + echo html_frame_end(" "); + +} else if ($aClean['sSubject'] && $aClean['sMessage']) +{ + $sMsg = "The following message was sent to you from $oUser->sRealname "; + $sMsg .= "through the Wine AppDB contact form.\nTo Reply, visit "; + $sMsg .= APPDB_ROOT."contact.php?iRecipientId=$oUser->iUserId\n\n"; + $sMsg .= $aClean['sMessage']; + + mail_appdb($oRecipient->sEmail, $aClean['sSubject'], $sMsg); + + util_redirect_and_exit(BASE."index.php"); +} + +?> Index: appdb/include/application.php diff -u -p appdb/include/application.php:1.85 appdb/include/application.php:1.86 --- appdb/include/application.php:1.85 18 Jan 2007 2:38:18 -0000 +++ appdb/include/application.php 18 Jan 2007 2:38:18 -0000 @@ -662,7 +662,9 @@ class Application { while(list($index, $userIdValue) = each($other_maintainers)) { $oUser = new User($userIdValue); - echo " <li>".$oUser->sRealname."</li>\n"; + echo " <li>$oUser->sRealname (<a href="". + BASE."contact.php?iRecipientId=$oUser->iUserId">". + "e-mail</a>)</li>\n"; } echo "</ul></td></tr>\n"; } else Index: appdb/include/version.php diff -u -p appdb/include/version.php:1.95 appdb/include/version.php:1.96 --- appdb/include/version.php:1.95 18 Jan 2007 2:38:18 -0000 +++ appdb/include/version.php 18 Jan 2007 2:38:18 -0000 @@ -680,7 +680,8 @@ class Version { while(list($index, $userIdValue) = each($aAllMaintainers)) { $oUser = new User($userIdValue); - echo "<li>".$oUser->sRealname."</li>"; + echo "<li>$oUser->sRealname (<a href="".BASE."contact.php?". + "iRecipientId=$oUser->iUserId">e-mail</a>)</li>"; } echo "</ul></td></tr>\n"; } else