Author: pwang
Date: 2013-01-11 16:20:27 -0800 (Fri, 11 Jan 2013)
New Revision: 31042
Modified:
new_cytoscape_website/bugreport/bugreport.php
Log:
Add blacklist of IP and email
Modified: new_cytoscape_website/bugreport/bugreport.php
===================================================================
--- new_cytoscape_website/bugreport/bugreport.php 2013-01-11 23:27:37 UTC
(rev 31041)
+++ new_cytoscape_website/bugreport/bugreport.php 2013-01-12 00:20:27 UTC
(rev 31042)
@@ -6,6 +6,13 @@
<?php
+// check black list of IP address
+$isIPInBlackList = isIPAddressInBlackList();
+
+if ($isIPInBlackList){
+ return;
+}
+
// mode = 'new', Data is submited by user
// mode = 'edit', Cytostaff edit the data in bugs DB
$mode = 'new'; // by default it is 'new'
@@ -72,6 +79,12 @@
}
if ($mode == 'new') {
+
+ // check if the email is in black list
+ if (isEmailInBlackList($bugReport['email'])) {
+ return;
+ }
+
//process the data and Save the data into DB.
$submitResult1 = submitNewBug($connection, $bugReport);
submitNewBug2Remine( $bugReport, $submitResult1);
@@ -92,7 +105,36 @@
<?php
+function isEmailInBlackList($email) {
+
+ $file_handle = fopen("_blacklist_email.txt", "r");
+ while (!feof($file_handle)) {
+ $line = trim(fgets($file_handle));
+
+ if(strcasecmp($email, $line) == 0){
+ return true;
+ }
+ }
+ fclose($file_handle);
+ return false;
+}
+function isIPAddressInBlackList(){
+
+ $remote_ip_address= trim($_SERVER['REMOTE_ADDR']);
+
+ $file_handle = fopen("_blacklist_ip.txt", "r");
+ while (!feof($file_handle)) {
+ $line = trim(fgets($file_handle));
+ if(strcasecmp($remote_ip_address, $line) == 0){
+ return true;
+ }
+ }
+ fclose($file_handle);
+ return false;
+}
+
+
function getBugID_redmine() {
$str = file_get_contents("_reportOutput.txt");
$obj = json_decode($str);
@@ -138,7 +180,11 @@
return false;
}
- return true;
+ if ($userInput['cyversion'] != null and
strpos($userInput['cyversion'],'3.0') !== false){
+ return true;
+ }
+ echo "Please correct Cytoscape version<br />";
+ return false;
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.