diff --git a/admin/award_awards.php b/admin/award_awards.php index 10c36aa6..33dc1f08 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -25,6 +25,7 @@ require_once('../common.inc.php'); require_once('../user.inc.php'); user_auth_required('committee', 'admin'); + require_once('awards.inc.php'); switch($_GET['action']) { case 'awardinfo_load': @@ -41,10 +42,7 @@ case 'award_delete': $id=intval($_GET['id']); - mysql_query("DELETE FROM award_prizes WHERE award_awards_id='$id'"); - mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'"); - mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'"); - mysql_query("DELETE FROM award_awards WHERE id='$id'"); + award_delete($id); exit; case 'awardinfo_save': @@ -213,8 +211,7 @@ case 'prize_delete': $id = intval($_GET['id']); - mysql_query("DELETE FROM award_prizes WHERE id='$id'"); -// echo "DELETE FROM award_prizes WHERE id='$id'"; + award_prize_delete($id); happy_("Prize deleted"); exit; diff --git a/admin/award_download.php b/admin/award_download.php index f87305c5..14836744 100644 --- a/admin/award_download.php +++ b/admin/award_download.php @@ -25,6 +25,7 @@ require_once('../user.inc.php'); user_auth_required('committee', 'admin'); require_once('curl.inc.php'); + require_once('awards.inc.php'); @@ -221,8 +222,7 @@ case 'check': /* Delete local entries that weren't downloaded */ foreach($existingprizes AS $ep) { echo " ".i18n("Removing prize %1",array($ep['prize']))."
"; - mysql_query("DELETE FROM award_prizes WHERE id='{$ep['id']}'"); - echo mysql_error(); + award_prize_delete($ep['id']); } } echo "
"; @@ -231,11 +231,7 @@ case 'check': //remove any awards that are left in the $existingawards array, they must have been removed from the source foreach($existingawards AS $aid=>$val) { echo i18n("Removing award id %1 that was removed from external source",array($aid))."
"; - - mysql_query("DELETE FROM award_prizes WHERE award_awards_id='$aid'"); - mysql_query("DELETE FROM award_awards WHERE id='$aid'"); - mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$aid'"); - mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$aid'"); + award_delete($aid); } echo ""; diff --git a/admin/awards.inc.php b/admin/awards.inc.php new file mode 100644 index 00000000..c8ae685f --- /dev/null +++ b/admin/awards.inc.php @@ -0,0 +1,49 @@ + + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> +