diff --git a/admin/communication.inc.php b/admin/communication.inc.php
index f02bdfce..7a54c460 100644
--- a/admin/communication.inc.php
+++ b/admin/communication.inc.php
@@ -1,7 +1,10 @@
+// This file was modified Jan of 2014 by Richard Sin
+// A glitch that grabs old emails has been resolved.
+
$mailqueries=array(
"committee_all"=>array("name"=>"Committee members (all)","query"=>
- "SELECT firstname, lastname, organization, email FROM users WHERE types LIKE '%committee%' AND deleted='no' GROUP BY uid"),
+ "SELECT u.firstname, u.lastname, u.organization, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%committee%' AND u.deleted='no' GROUP BY `u`.`id` ASC"),
/* The WHERE clause evaluates which rows to add to the GROUP
BY, the HAVING clase evaluates which grouped rows show up. We
@@ -11,8 +14,7 @@
end up picking up a user active in, say 2007 and 2008, but
deleted in 2009. */
"judges_all"=>array("name"=>"Judges from all years (except deleted judges)","query"=>
- "SELECT firstname, lastname, email, deleted, MAX(year)
- FROM users WHERE types LIKE '%judge%' GROUP BY uid HAVING deleted='no' ORDER BY email"),
+ "SELECT u.firstname, u.lastname, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid ) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%judge%' AND u.deleted='no' ORDER BY `u`.`email` ASC"),
"judges_active_lastyear"=>array("name"=>"Judges (all) active from last year", "query"=>
"SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='".($config['FAIRYEAR']-1)."' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"),
@@ -181,15 +183,16 @@
"SELECT schools.sciencehead_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools
JOIN users ON schools.sciencehead_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.sciencehead_uid ORDER BY `year` DESC LIMIT 1)
WHERE schools.year='".$config['FAIRYEAR']."' AND users.email!=''"),
-
+ "school_thisyear"=>array("name"=>"School this year","query"=>
+ "SELECT board, schoolemail FROM `schools` WHERE `year` ='".$config['FAIRYEAR']."' GROUP BY schoolemail"),
"school_teachers_thisyear"=>array("name"=>"Teachers (as entered by students) this year","query"=>
- "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".$config['FAIRYEAR']."' AND teacheremail!=''"),
+ "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '".$config['FAIRYEAR']."' GROUP BY teacheremail"),
"school_teachers_lastyear"=>array("name"=>"Teachers (as entered by students) last year","query"=>
- "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".($config['FAIRYEAR']-1)."' AND teacheremail!=''"),
+ "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '".($config['FAIRYEAR']-1)."' GROUP BY teacheremail"),
"school_teachers_allyears"=>array("name"=>"Teachers (as entered by students) all years","query"=>
- "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE teacheremail!=''"),
+ "SELECT teachername AS firstname, teacheremail AS email FROM students GROUP BY teacheremail"),
/* Volunteers */
"volunteers_active_complete_thisyear"=>array("name"=>"Volunteers active for this year and complete", "query"=>
"SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='yes' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND types LIKE '%volunteer%' ORDER BY email"),
diff --git a/admin/communication.php b/admin/communication.php
index 06506b7c..21c7fc3b 100644
--- a/admin/communication.php
+++ b/admin/communication.php
@@ -25,6 +25,7 @@
require_once("../common.inc.php");
require_once("../user.inc.php");
include "communication.inc.php";
+
user_auth_required('committee', 'admin');
function launchQueue() {
diff --git a/admin/project_editor.php b/admin/project_editor.php
index 5cfd40d1..3d6d66ea 100644
--- a/admin/project_editor.php
+++ b/admin/project_editor.php
@@ -20,6 +20,11 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+
+// This file was modified Jan of 2014 by Richard Sin
+// Project type has been added and can be toggled by configuration.
+// Feedback box also has been added for flagging purposes
+
?>
require_once('../common.inc.php');
@@ -106,6 +111,20 @@ function project_save()
else
$summarycountok=1;
+ //check if it is flagged then update it
+
+ if(empty($_POST['feedback'])) {
+ mysql_query("UPDATE projects SET ".
+ "flagged='0'".
+ "WHERE id='".intval($_POST['id'])."'");
+ } else {
+ mysql_query("UPDATE projects SET ".
+ "flagged='1'".
+ "WHERE id='".intval($_POST['id'])."'");
+ }
+ echo mysql_error();
+ happy_("Flagging process successfully updated");
+
if($config['participant_project_title_charmax'] && strlen(stripslashes($_POST['title']))>$config['participant_project_title_charmax']) { //0 for no limit, eg 255 database field limit
$title=substr(stripslashes($_POST['title']),0,$config['participant_project_title_charmax']);
error_("Project title truncated to %1 characters",array($config['participant_project_title_charmax']));
@@ -115,12 +134,14 @@ function project_save()
mysql_query("UPDATE projects SET ".
"title='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",$title))."', ".
"projectdivisions_id='".intval($_POST['projectdivisions_id'])."', ".
+ "projecttype='".mysql_escape_string(stripslashes($_POST['projecttype']))."', ".
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
"req_special='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['req_special'])))."', ".
"summary='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['summary'])))."', ".
"summarycountok='$summarycountok',".
+ "feedback='".mysql_escape_string(iconv("UTF-8","ISO-8859-1//TRANSLIT",stripslashes($_POST['feedback'])))."', ".
"projectsort='".mysql_escape_string(stripslashes($_POST['projectsort']))."'".
"WHERE id='".intval($_POST['id'])."'");
echo mysql_error();
@@ -145,7 +166,6 @@ function project_save()
function project_load()
{
global $registrations_id, $config;
-
//now lets find out their MAX grade, so we can pre-set the Age Category
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
$gradeinfo=mysql_fetch_object($q);
@@ -226,8 +246,32 @@ function countwords()
=i18n("Project Sort")?>:
-
-
+
+
+
+if($config['project_type'] == 'yes'){
+ $q=mysql_query("SELECT * FROM projecttypes ORDER BY type");
+ echo "