From 31a029f98b6de6afbe85dfed7662474e8dc02596 Mon Sep 17 00:00:00 2001 From: DDKnoll Date: Tue, 14 Dec 2010 14:38:24 -0800 Subject: [PATCH 1/8] google calender link is now working --- detailView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detailView.php b/detailView.php index 7a1cbda..9e4481e 100644 --- a/detailView.php +++ b/detailView.php @@ -130,7 +130,7 @@ function date_to_string($array) { $endingDate = explode("-", $array[0][4]); $endingTime = explode(":", $array[0][5]); $googleDate = sprintf("%04d%02d%02dT%02d%02d00Z/%04d%02d%02dT%02d%02d00Z", - $startingDate[1], $startingDate[1], $startingDate[2], + $startingDate[0], $startingDate[1], $startingDate[2], ($startingTime[0] + 6), $endingTime[1], $endingDate[0], $endingDate[1], $endingDate[2], ($endingTime[0] + 06), $endingTime[1]); From 3fc1ac4a04828b895fdef9ecd08c661381bb8219 Mon Sep 17 00:00:00 2001 From: Andrew Hirakawa Date: Thu, 16 Dec 2010 14:40:41 -0600 Subject: [PATCH 2/8] fixed login bug --- user_accounts/login_processing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_accounts/login_processing.php b/user_accounts/login_processing.php index 8a496ab..5752c31 100755 --- a/user_accounts/login_processing.php +++ b/user_accounts/login_processing.php @@ -5,7 +5,7 @@ if(isset($_POST['username']) && isset($_POST['password'])) { require_once '../global.php'; - $user = addslashes($_POST['username']); + $user = trim(addslashes($_POST['username'])); $pass = $static ? $_POST['password'] : md5($_POST['password']); $query = "SELECT * FROM users "; From 2c0fd1d4b9602df8570c2675b52a2522f603354e Mon Sep 17 00:00:00 2001 From: Andrew Hirakawa Date: Thu, 16 Dec 2010 15:03:42 -0600 Subject: [PATCH 3/8] events now also organized by startTime bug fix --- functions/query_events.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) mode change 100644 => 100755 functions/query_events.php diff --git a/functions/query_events.php b/functions/query_events.php old mode 100644 new mode 100755 index 7fcbb3e..59afbae --- a/functions/query_events.php +++ b/functions/query_events.php @@ -37,7 +37,7 @@ function get_tag_ids($tag) { function get_basic_search_ids () { $criteria = addslashes($_GET["input"]); $terms = explode(" ", $criteria); - + $input = array(); $input[] = "locations.locationID = events.locationID"; $input[] = "categories.categoryID = events.categoryID"; @@ -166,6 +166,7 @@ function get_events($eventIDs,$sort='time',$limit=10) { if ($eventIDs === false) return false; $IDs = array(); $results = array(); + $oderby = false; $query = "SELECT events.eventName, events.description, @@ -193,13 +194,27 @@ function get_events($eventIDs,$sort='time',$limit=10) { $query .= implode(" OR ", $IDs); $query .= ") "; - if ($sort == 'time') $query .= 'ORDER BY events.startDate ASC'; - if ($sort == 'popularity') $query .= 'ORDER BY events.startDate ASC, events.popularity DESC'; - if ($sort == 'location') $query .= 'ORDER BY events.startDate ASC, locations.locationName ASC'; - if ($sort == 'category') $query .= 'ORDER BY events.startDate ASC, categories.categoryName ASC'; + if ($sort == 'time') { + $query .= 'ORDER BY events.startDate ASC, events.startTime'; + $orderby = true; + } + if ($sort == 'popularity') { + $query .= 'ORDER BY events.startDate ASC, events.popularity DESC, events.startTime'; + $orderby = true; + } + if ($sort == 'location') { + $query .= 'ORDER BY events.startDate ASC, locations.locationName ASC, events.startTime'; + $orderby = true; + } + if ($sort == 'category') { + $query .= 'ORDER BY events.startDate ASC, categories.categoryName ASC, events.startTime'; + $orderby = true; + } + if(!$orderby){ + $query .= 'ORDER BY ,events.startTime'; + } $query .= ' LIMIT '.$limit; - $result = mysql_query($query); if ($result) { From 9b9ea4248adb817f8de7904f0ebdb6e1f3233d87 Mon Sep 17 00:00:00 2001 From: Andrew Hirakawa Date: Thu, 16 Dec 2010 15:04:22 -0600 Subject: [PATCH 4/8] events now also organized by startTime bug fix --- functions/query_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/query_events.php b/functions/query_events.php index 59afbae..4d6d52f 100755 --- a/functions/query_events.php +++ b/functions/query_events.php @@ -211,7 +211,7 @@ function get_events($eventIDs,$sort='time',$limit=10) { $orderby = true; } if(!$orderby){ - $query .= 'ORDER BY ,events.startTime'; + $query .= 'ORDER BY events.startTime'; } $query .= ' LIMIT '.$limit; From bb56e7ae7993f82d6f6cb1c938ec40557e114a04 Mon Sep 17 00:00:00 2001 From: Andrew Hirakawa Date: Thu, 16 Dec 2010 16:00:47 -0600 Subject: [PATCH 5/8] Category Management Adheres to PEAR --- categories.php | 193 ++++++++++++++++++++++++--------------------- categoryAdmin2.php | 68 +++++++++++----- 2 files changed, 151 insertions(+), 110 deletions(-) mode change 100644 => 100755 categoryAdmin2.php diff --git a/categories.php b/categories.php index df1476e..40ae694 100755 --- a/categories.php +++ b/categories.php @@ -1,121 +1,136 @@ '; - echo '
'; +echo '
'; +echo '
'; - if ( $_POST ) - { - $queryDelete = 'UPDATE categories SET permanent=0 WHERE categoryID = '; - $queryAdd = 'UPDATE categories SET permanent=1 WHERE categoryID = '; - - $addArray = array_keys( $_POST, 'add' ); - $deleteArray = array_keys( $_POST, 'delete' ); +if ($_POST) { + $query_delete = 'UPDATE categories SET permanent=0 WHERE categoryID = '; + $query_add = 'UPDATE categories SET permanent=1 WHERE categoryID = '; + $add_array = array_keys($_POST, 'add'); + $delete_array = array_keys($_POST, 'delete'); - if ( $addArray ) - { - $queryAdd .= implode( ' OR categoryID = ', $addArray ); - $resultAdd = mysql_query($queryAdd); - echo mysql_error(); - /* To do: error check */ - } + if ($addArray) { + $query_add .= implode(' OR categoryID = ', $add_array); + $result_add = mysql_query($query_add); + echo mysql_error(); + /* To do: error check */ + } - if ( $deleteArray ) - { - $queryDelete .= implode( ' OR categoryID = ', $deleteArray ); - $resultDelete = mysql_query($queryDelete); - echo mysql_error(); - /* To do: error check */ - } - } + if ($delete_array) { + $query_delete .= implode(' OR categoryID = ', $delete_array); + $result_delete = mysql_query($query_delete); + echo mysql_error(); + /* To do: error check */ + } +} - $queryPerm = "SELECT * FROM categories +$query_perm = "SELECT * FROM categories WHERE permanent=1 ORDER BY requestCount DESC, categoryName ASC"; - $resultPerm = mysql_query($queryPerm); +$result_perm = mysql_query($query_perm); - $queryTemp = "SELECT * FROM categories +$query_temp = "SELECT * FROM categories WHERE permanent=0 ORDER BY requestCount DESC, categoryName ASC"; - $resultTemp = mysql_query($queryTemp); - ?> +$result_temp = mysql_query($query_temp); +?> -
- - - - + +
-

Permanent Categories

-
+ + + - - - - - + + + + + - + - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - - - + + + + + - + -
+

Permanent Categories

+
CategoryRequestsDelete
CategoryRequestsDelete
-

Temporary Categories

-
+

Temporary Categories

+
CategoryRequestsAdd
CategoryRequestsAdd
+ - -
+ + - +th { + text-align: left; + font-size: 14px; +color: #555; +} + - '; - require_once 'sidebar.php'; - echo '
'; - require_once 'footer.php'; +'; +require_once 'sidebar.php'; +echo '
'; +require_once 'footer.php'; ?> diff --git a/categoryAdmin2.php b/categoryAdmin2.php old mode 100644 new mode 100755 index f05df23..739830d --- a/categoryAdmin2.php +++ b/categoryAdmin2.php @@ -1,4 +1,21 @@ Rename $name){ + +foreach ($category_names as $id => $name) { echo "\n"; echo "" . $name . "\n"; - echo "" . $categoryRequests[$id] . "\n"; + echo "" . $category_requests[$id] . "\n"; echo "" . "
" . "\n"; echo "" . "\n"; echo "" . $name . "\n"; - echo "" . $tempCategoryRequests[$id] . "\n"; + echo "" . $temp_category_requests[$id] . "\n"; echo "" . "
" . "\n"; echo "" . "= '".date('Y-m-d')."';"; $result = mysql_query($query); - if ($result) { + if (mysql_num_rows($result) != 0) { $eventIDs = array(); while($row = mysql_fetch_row($result)) $eventIDs[] = $row[0]; } else { @@ -33,17 +33,17 @@ function get_tag_ids($tag) { return $eventIDs; } - - function get_basic_search_ids () { + + function get_basic_search_ids () { $criteria = addslashes($_GET["input"]); $terms = explode(" ", $criteria); $input = array(); + $input[] = 'events.endDate >= "'.date('Y-m-d').'"'; $input[] = "locations.locationID = events.locationID"; $input[] = "categories.categoryID = events.categoryID"; $input[] = "users.userID = events.userID"; $input[] = "tags.eventID = events.eventID"; - $input[] = "events.startDate >= \"".date('Y-m-d')."\""; $inputpt2 = array(); foreach ($terms as $term) { @@ -59,13 +59,52 @@ function get_basic_search_ids () { } } - $query = "SELECT events.eventID FROM events, locations, categories, users, tags "; + $query = "SELECT DISTINCT events.eventID FROM events, locations, categories, users, tags "; + $query .= "WHERE " . implode(" AND ", $input) ; + $query .= " AND (" . implode(" OR ", $inputpt2) . ")" ; + + $resource = mysql_query($query); + + if (mysql_num_rows($resource) != 0) { + $eventIDs = array(); + while($row = mysql_fetch_row($resource)) $eventIDs[] = $row[0]; + } else { + $eventIDs = get_basic_search_ids_without_tags(); + } + + return $eventIDs; + } + + function get_basic_search_ids_without_tags () { + $criteria = addslashes($_GET["input"]); + $terms = explode(" ", $criteria); + + $input = array(); + $input[] = 'events.endDate >= "'.date('Y-m-d').'"'; + $input[] = "locations.locationID = events.locationID"; + $input[] = "categories.categoryID = events.categoryID"; + $input[] = "users.userID = events.userID"; + + $inputpt2 = array(); + foreach ($terms as $term) { + if(strlen($term) > 0){ + $inputpt2[] = "(events.eventName LIKE '%$term%')"; + $inputpt2[] = "(events.description LIKE '%$term%')"; + $inputpt2[] = "(locations.locationName LIKE '%$term%')"; + $inputpt2[] = "(categories.categoryName LIKE '%$term%')"; + $inputpt2[] = "(users.displayName LIKE '%$term%')"; + } else { + return false; + } + } + + $query = "SELECT DISTINCT events.eventID FROM events, locations, categories, users "; $query .= "WHERE " . implode(" AND ", $input) ; $query .= " AND (" . implode(" OR ", $inputpt2) . ")" ; $resource = mysql_query($query); - if ($resource) { + if (mysql_num_rows($resource) != 0) { $eventIDs = array(); while($row = mysql_fetch_row($resource)) $eventIDs[] = $row[0]; } else { @@ -144,7 +183,7 @@ function get_advance_search_ids () { $resource = mysql_query($query); - if ($resource) { + if (mysql_num_rows($resource) != 0) { $eventIDs = array(); while($row = mysql_fetch_row($resource)) $eventIDs[] = $row[0]; } else { @@ -155,7 +194,7 @@ function get_advance_search_ids () { $query = "SELECT events.eventID FROM events, locations, categories "; $query .= "WHERE " . implode(" AND ", $input_current) . ";"; $resource = mysql_query($query); - if ($resource) while($row = mysql_fetch_row($resource)) $eventIDs[] = $row[0]; + if (mysql_num_rows($resource) != 0) while($row = mysql_fetch_row($resource)) $eventIDs[] = $row[0]; } return $eventIDs; @@ -202,7 +241,7 @@ function get_events($eventIDs,$sort='time',$limit=10) { $result = mysql_query($query); - if ($result) { + if (mysql_num_rows($result) != 0) { while($row = mysql_fetch_row($result))$results[] = $row; return $results; } else { diff --git a/js/fancy_login.php b/js/fancy_login.php index 57662e3..8fd2c51 100644 --- a/js/fancy_login.php +++ b/js/fancy_login.php @@ -28,15 +28,16 @@ var submit_tag = function () { var tag = $('input#tag-list').val(); var eventID = $('.event_listing').attr("id"); + var html = $('.event_listing').attr("id"); $.ajax({ type: "POST", url: "submit_tag.php", - data: ({tags:tag,eventID:eventID}), - success: function (r) { - $('span.val.tags').append(", "+encodeURI(tag)); - } - + data: ({tags:tag,eventID:eventID}), + success: function (r) { + $('span.val.tags').load(' span.val.tags').hide().fadeIn("slow"); + } + }); } From b9cefb6f9ae7da56c13c9494558baa484e07b6db Mon Sep 17 00:00:00 2001 From: uysalere Date: Thu, 16 Dec 2010 17:40:32 -0600 Subject: [PATCH 7/8] fixed more bugs --- edit_submit.php | 2 +- forms.php | 3 +++ functions/query_events.php | 1 + search.php | 2 +- submit.php | 4 ++++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/edit_submit.php b/edit_submit.php index e55ba28..3761a0c 100644 --- a/edit_submit.php +++ b/edit_submit.php @@ -31,7 +31,7 @@ $end_time = $end_temp[1]; $start = $start_date.' '.$start_time; $end = $end_date.' '.$end_time; - if(($start < $right_now) || ($end < $right_now)) { + if(($end < $right_now) || ($end < $start)) { header('Location: '.ed(false).'edit.php?time=f&s=t&eventID='.$eventID); exit(); } diff --git a/forms.php b/forms.php index 105c531..9c69bef 100644 --- a/forms.php +++ b/forms.php @@ -10,6 +10,9 @@ else : if($_GET['s'] == 'f') { echo '

Missing some fields; event not added


'; + } + if($_GET['s'] == 'time') { + echo '

You cannot add an old event


'; } elseif ($_GET['s'] == 't') { echo '

Your event has been added sucessfully


'; diff --git a/functions/query_events.php b/functions/query_events.php index c80dcc6..6936641 100755 --- a/functions/query_events.php +++ b/functions/query_events.php @@ -180,6 +180,7 @@ function get_advance_search_ids () { $query = "SELECT events.eventID FROM events, locations, categories "; $query .= "WHERE " . implode(" AND ", $input) . ";"; + echo $query; $resource = mysql_query($query); diff --git a/search.php b/search.php index 788f9c8..aa921e0 100755 --- a/search.php +++ b/search.php @@ -8,7 +8,7 @@
- +
diff --git a/submit.php b/submit.php index f06f319..33c7031 100644 --- a/submit.php +++ b/submit.php @@ -40,6 +40,10 @@ $end_time = $end_temp[1]; $start = $start_date.' '.$start_time; $end = $end_date.' '.$end_time; + if(($start < $right_now) || ($end < $right_now) || ($end < $start)) { + header('Location: '.ed(false).'forms.php?s=time'); + exit(); + } // sanitize description box $description = htmlspecialchars($description); From 1ef07e0bea934714cba763681af66315bd2e000b Mon Sep 17 00:00:00 2001 From: uysalere Date: Thu, 16 Dec 2010 22:55:35 -0600 Subject: [PATCH 8/8] flagging implemented --- delete_event.php | 12 ++++++------ detailView.php | 8 +++++--- flag_admin.php | 36 ++++++++++++++++++++++++++++++++++++ flag_event.php | 26 ++++++++++++++++++++++++++ flag_reset.php | 24 ++++++++++++++++++++++++ functions/query_events.php | 20 +++++++++++++++++++- global.php | 2 +- sidebar.php | 9 +++++++++ 8 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 flag_admin.php create mode 100644 flag_event.php create mode 100644 flag_reset.php diff --git a/delete_event.php b/delete_event.php index 21aa67d..a4c4d64 100644 --- a/delete_event.php +++ b/delete_event.php @@ -11,15 +11,15 @@ //check if the user created the event $query = "SELECT userID - FROM events - WHERE eventID = $eventID;"; +FROM events +WHERE eventID = $eventID;"; $result = mysql_query($query); $row = mysql_fetch_row($result); //check if the user is an admin $query = "SELECT accessLevel - FROM users - WHERE userID = $userID;"; +FROM users +WHERE userID = $userID;"; $result = mysql_query($query); $row2 = mysql_fetch_row($result); @@ -41,7 +41,7 @@ exit(); } } else { - header('Location: '.ed(false).'detailView.php?s=f&eventID='.$eventID); + header('Location: '.ed(false).'detailView.php?eventID='.$eventID); exit(); } -?> +?> \ No newline at end of file diff --git a/detailView.php b/detailView.php index 9e4481e..e3c1515 100644 --- a/detailView.php +++ b/detailView.php @@ -2,11 +2,13 @@ require_once "global.php"; require_once "header.php"; ?> -
Your report has been submitted to the administrators...
'; + $eventID = htmlspecialchars($_GET['eventID']); $eventArray = get_events(array($eventID)); @@ -65,7 +67,7 @@ What: Where: Attending: - + @@ -85,6 +87,7 @@
+ Report! Add Tags - //Display 'like' feature from facebook '; + include 'footer.php'; +?> \ No newline at end of file diff --git a/flag_event.php b/flag_event.php new file mode 100644 index 0000000..6686b4b --- /dev/null +++ b/flag_event.php @@ -0,0 +1,26 @@ + diff --git a/flag_reset.php b/flag_reset.php new file mode 100644 index 0000000..083df0a --- /dev/null +++ b/flag_reset.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/functions/query_events.php b/functions/query_events.php index 6936641..4459283 100755 --- a/functions/query_events.php +++ b/functions/query_events.php @@ -15,6 +15,25 @@ function get_event_comments($eventID) { return $comments; } + + function get_number_of_flagged() { + $flagged_query = "SELECT count(*) FROM events + WHERE events.flagged=1"; + $flagged_result = mysql_query($flagged_query); + $row = mysql_fetch_array($flagged_result); + + return $row[0]; + } + + function get_number_of_flaggedCount() { + $flagged_query = "SELECT sum(flaggedCount) FROM events + WHERE events.flagged=1"; + $flagged_result = mysql_query($flagged_query); + $row = mysql_fetch_array($flagged_result); + + return $row[0]; + } + function get_tag_ids($tag) { $query = "SELECT DISTINCT tags.eventID @@ -180,7 +199,6 @@ function get_advance_search_ids () { $query = "SELECT events.eventID FROM events, locations, categories "; $query .= "WHERE " . implode(" AND ", $input) . ";"; - echo $query; $resource = mysql_query($query); diff --git a/global.php b/global.php index d163085..6a667f0 100755 --- a/global.php +++ b/global.php @@ -21,7 +21,7 @@ * currently using. VERY IMPORTANT. */ - $_DIR = '/~liujingt/GCal/'; // CHANGE ME + $_DIR = '/~uysalere/GCal/'; // CHANGE ME function ed($e=true) { global $_DIR; diff --git a/sidebar.php b/sidebar.php index 997a02d..2ed50bb 100644 --- a/sidebar.php +++ b/sidebar.php @@ -1,5 +1,6 @@ '; ?>
@@ -92,6 +93,14 @@ ?>
+ 0)){ + echo '';} + ?>

Tag Cloud