Make the membership list dynamic.
2005-11-13 Vincent Untz <vuntz@gnome.org> Make the membership list dynamic. * foundation.gnome.org/htaccess: updated for the move of the list * foundation.gnome.org/membership/.cvsignore: updated * foundation.gnome.org/membership/Makefile.am: updated * foundation.gnome.org/membership/index.wml: fix link * foundation.gnome.org/membership/members.wml: use some PHP magic * foundation.gnome.org/vote/vote.wml: fix some tags for xhtml
This commit is contained in:
		
							parent
							
								
									448470ba4b
								
							
						
					
					
						commit
						3062d7b29f
					
				
					 7 changed files with 88 additions and 14 deletions
				
			
		
							
								
								
									
										12
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								ChangeLog
									
										
									
									
									
								
							|  | @ -1,3 +1,15 @@ | ||||||
|  | 2005-11-13  Vincent Untz  <vuntz@gnome.org> | ||||||
|  | 
 | ||||||
|  | 	Make the membership list dynamic. | ||||||
|  | 
 | ||||||
|  | 	* foundation.gnome.org/htaccess: updated for the move of the list | ||||||
|  | 	* foundation.gnome.org/membership/.cvsignore: updated | ||||||
|  | 	* foundation.gnome.org/membership/Makefile.am: updated | ||||||
|  | 	* foundation.gnome.org/membership/index.wml: fix link | ||||||
|  | 	* foundation.gnome.org/membership/members.wml: use some PHP magic | ||||||
|  | 
 | ||||||
|  | 	* foundation.gnome.org/vote/vote.wml: fix some tags for xhtml | ||||||
|  | 
 | ||||||
| 2005-11-09  Murray Cumming <murrayc@murrayc.com> | 2005-11-09  Murray Cumming <murrayc@murrayc.com> | ||||||
| 
 | 
 | ||||||
| 	* foundation.gnome.org/licensing/guidelines/index.wml:  | 	* foundation.gnome.org/licensing/guidelines/index.wml:  | ||||||
|  |  | ||||||
|  | @ -9,7 +9,8 @@ Redirect /bylaws.pdf			http://foundation.gnome.org/about/bylaws.pdf | ||||||
| 
 | 
 | ||||||
| # Move of the membership stuff | # Move of the membership stuff | ||||||
| Redirect /membership.html		http://foundation.gnome.org/membership/ | Redirect /membership.html		http://foundation.gnome.org/membership/ | ||||||
| Redirect /membership-list.html		http://foundation.gnome.org/membership/members.html | Redirect /membership-list.html		http://foundation.gnome.org/membership/members.php | ||||||
|  | Redirect /membership/members.html		http://foundation.gnome.org/membership/members.php | ||||||
| Redirect /membership-policy.html	http://foundation.gnome.org/membership/ | Redirect /membership-policy.html	http://foundation.gnome.org/membership/ | ||||||
| Redirect /membership-form.html		http://foundation.gnome.org/membership/application.php | Redirect /membership-form.html		http://foundation.gnome.org/membership/application.php | ||||||
| Redirect /membership-form.php		http://foundation.gnome.org/membership/application.php | Redirect /membership-form.php		http://foundation.gnome.org/membership/application.php | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| members.html | members.php | ||||||
| application.php | application.php | ||||||
| index.html | index.html | ||||||
| Makefile.in | Makefile.in | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ urlpath = /membership | ||||||
|   |   | ||||||
| page_SCRIPTS = \ | page_SCRIPTS = \ | ||||||
|         index.html	\ |         index.html	\ | ||||||
|         members.html	\ |         members.php	\ | ||||||
|         application.php |         application.php | ||||||
| 
 | 
 | ||||||
| include $(top_srcdir)/rules.common | include $(top_srcdir)/rules.common | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
|       for election to the Board of Directors, vote in the elections for the |       for election to the Board of Directors, vote in the elections for the | ||||||
|       Board of Directors, and suggest referenda. The membership process is |       Board of Directors, and suggest referenda. The membership process is | ||||||
|       overseen by the Membership and Elections Committee. You can also browse |       overseen by the Membership and Elections Committee. You can also browse | ||||||
|       the <a href="members.html">current membership list</a>. |       the <a href="members.php">current membership list</a>. | ||||||
|     </p> |     </p> | ||||||
| 
 | 
 | ||||||
|     <p> |     <p> | ||||||
|  |  | ||||||
|  | @ -16,9 +16,70 @@ | ||||||
|       href="mailto:membership-committee@gnome.org">membership-committee@gnome.org</a>. |       href="mailto:membership-committee@gnome.org">membership-committee@gnome.org</a>. | ||||||
|     </p> |     </p> | ||||||
| 
 | 
 | ||||||
|     <p> | <?php | ||||||
|       The list is currently being rebuilt. Please retry later. | $error = null; | ||||||
|     </p> | 
 | ||||||
|  | function get_members_from_sql () { | ||||||
|  |   global $error; | ||||||
|  | 
 | ||||||
|  |   if (is_readable ("/home/admin/secret/anonvoting")) { | ||||||
|  |     include ("/home/admin/secret/anonvoting"); | ||||||
|  |   } else { | ||||||
|  |     $error = "Can not get the authentication data."; | ||||||
|  |     return FALSE; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   $members_table = "foundationmembers"; | ||||||
|  | 
 | ||||||
|  |   $handle = mysql_connect ("$mysql_host", "$mysql_user", "$mysql_password"); | ||||||
|  |   if (!$handle) { | ||||||
|  |     $error = "Can not connect to the database."; | ||||||
|  |     return FALSE; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   $select_base = mysql_select_db ($mysql_db, $handle);  | ||||||
|  |   if (!$select_base) { | ||||||
|  |     mysql_close ($handle); | ||||||
|  |     $error = "Can not select the database."; | ||||||
|  |     return FALSE; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   $query = "SELECT firstname, lastname, email FROM ".$members_table; | ||||||
|  |   $query .= " WHERE DATE_SUB(CURDATE(), INTERVAL 2 YEAR) <= last_renewed_on"; | ||||||
|  |   $query .= " ORDER BY lastname, firstname"; | ||||||
|  | 
 | ||||||
|  |   $result = mysql_query ($query, $handle); | ||||||
|  | 
 | ||||||
|  |   if ($result === FALSE) { | ||||||
|  |     $error = mysql_error ($handle); | ||||||
|  |     $retval = FALSE; | ||||||
|  |   } else { | ||||||
|  |     $result_array = array (); | ||||||
|  |     while ($buffer = mysql_fetch_assoc ($result)) { | ||||||
|  |       $result_array[] = $buffer; | ||||||
|  |     } | ||||||
|  |     $retval = $result_array; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   mysql_close ($handle); | ||||||
|  |   return $retval; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | $members = get_members_from_sql (); | ||||||
|  | 
 | ||||||
|  | if ($members === FALSE) { | ||||||
|  |   echo "<p>Error: ".$error.".</p>\n"; | ||||||
|  | } else { | ||||||
|  |   echo "    <ul>\n"; | ||||||
|  |   $antispam = array(".", "@"); | ||||||
|  | 
 | ||||||
|  |   foreach ($members as $member) { | ||||||
|  |     $email = str_replace($antispam, "", $member["email"]); | ||||||
|  |     echo "      <li>".$member["firstname"]." ".$member["lastname"]." <".$email."></li>\n"; | ||||||
|  |   } | ||||||
|  |   echo "    </ul>\n"; | ||||||
|  | } | ||||||
|  | ?> | ||||||
|   |   | ||||||
|   </body> |   </body> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
|  | @ -149,12 +149,12 @@ echo $result; | ||||||
| 
 | 
 | ||||||
| if ($step != $max_step && $step >= 1) { | if ($step != $max_step && $step >= 1) { | ||||||
|   if ($step > 1) { |   if ($step > 1) { | ||||||
|     echo "  <input type=\"hidden\" name=\"email\" value=\"".$email."\">\n"; |     echo "  <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n"; | ||||||
|     echo "  <input type=\"hidden\" name=\"tmp_token\" value=\"".$tmp_token."\">\n"; |     echo "  <input type=\"hidden\" name=\"tmp_token\" value=\"".$tmp_token."\" />\n"; | ||||||
|   } |   } | ||||||
|   if ($step > 2) { |   if ($step > 2) { | ||||||
|     if ($choices_nb == 1) |     if ($choices_nb == 1) | ||||||
|       echo "  <input type=\"hidden\" name=\"vote\" value=\"".$vote."\">\n"; |       echo "  <input type=\"hidden\" name=\"vote\" value=\"".$vote."\" />\n"; | ||||||
|     else { |     else { | ||||||
|       foreach ($choices as $choice) { |       foreach ($choices as $choice) { | ||||||
|         $name = "vote".$choice["id"]; |         $name = "vote".$choice["id"]; | ||||||
|  | @ -163,13 +163,13 @@ if ($step != $max_step && $step >= 1) { | ||||||
|         else |         else | ||||||
|           $value = ""; |           $value = ""; | ||||||
| 
 | 
 | ||||||
|         echo "  <input type=\"hidden\" name=\"".$name."\" value=\"".$value."\">\n"; |         echo "  <input type=\"hidden\" name=\"".$name."\" value=\"".$value."\" />\n"; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   echo "  <input type=\"hidden\" name=\"election_id\" value=\"".$election_id."\">\n"; |   echo "  <input type=\"hidden\" name=\"election_id\" value=\"".$election_id."\" />\n"; | ||||||
|   echo "  <input type=\"hidden\" name=\"step\" value=\"".($step + 1)."\">\n"; |   echo "  <input type=\"hidden\" name=\"step\" value=\"".($step + 1)."\" />\n"; | ||||||
|   echo "  <input type=\"submit\" value=\"Continue to next step\">\n"; |   echo "  <input type=\"submit\" value=\"Continue to next step\" />\n"; | ||||||
|   echo "</form>\n"; |   echo "</form>\n"; | ||||||
| } | } | ||||||
| ?> | ?> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Vincent Untz
						Vincent Untz