public function getComments($thread_id) { $this->comments = array(); $result = mysql_do("SELECT id FROM comments WHERE hypothesis_id='{$this->id}' AND evidence_id='0' AND reply_to_id='{$thread_id}';"); while ($query_data = mysql_fetch_array($result)) { $this->comments[] = $query_data['id']; } return true; }
<div class="mainContainer"> <div class="ydsf left"> <div class="inner"> <div class="main"> <h2>Classes matching "<span class="hilight"><?php echo $tag; ?> </span>"</h2> <?php $tag_space = $tag . " "; $result = mysql_do("SELECT * FROM classes WHERE tags LIKE '%{$tag_space}%'"); while ($query_data = mysql_fetch_array($result)) { $this_teacher = new User(); $this_teacher->populateFromID($query_data['user_id']); ?> <p><a href="<?php echo $base_URL; ?> class/<?php echo $query_data['id']; ?> "><?php echo $query_data['title']; ?> </a><br />
<?php $counter = 0; //RETRIEVE ALL NEW MESSAGE BOARD COMMENTS ADDED TO USER'S PROJECTS IN THE LAST SEVEN DAYS $result = mysql_do("SELECT * FROM comments WHERE project_id IN ({$project_list}) AND created > DATE_SUB(CURDATE(),INTERVAL 7 DAY) ORDER BY `created` DESC LIMIT 20;"); while ($query_data = mysql_fetch_array($result)) { if ($counter == 0) { ?> <h3>Comments in Your Projects</h3> <div class="recentComments"> <?php } // Probably needs optimizing. $this_project = new Project(); $this_project->get($query_data['project_id']); if ($query_data['evidence_id'] > 0) { $this_evidence = new Evidence(); $this_evidence->get($query_data['evidence_id']); }
if (in_array($query_data['evidence_id'], $old_evidence) && in_array($query_data['hypothesis_id'], $old_hypotheses)) { for ($i = 0; $i < count($old_evidence); $i++) { if ($old_evidence[$i] == $query_data['evidence_id']) { $new_evidence_id = $new_evidence[$i]; } } for ($i = 0; $i < count($old_hypotheses); $i++) { if ($old_hypotheses[$i] == $query_data['hypothesis_id']) { $new_hypothesis_id = $new_hypotheses[$i]; } } $new_user_id = $query_data['user_id']; $new_rating = $query_data['rating']; $new_note = $query_data['note']; $new_created = $query_data['created']; mysql_do("INSERT INTO ratings (hypothesis_id, evidence_id, user_id, rating, note, created) VALUES ('{$new_hypothesis_id}', '{$new_evidence_id}', '{$new_user_id}', '{$new_rating}', '{$new_note}', '{$new_created}')"); } } //mysql_do("INSERT INTO users_in_projects (user_id, project_id) VALUES ('$active_user_id', '$new_project_id')"); //AFTER ALL THE DATA IS DUPLICATED, THE USER IS SENT TO THE PROJECT EDIT PAGE... ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=<?php echo $base_URL; ?> project/<?php echo $active_project->id; ?>
function mysql_fast($sql) { // Cached SQL statements, DOESN'T RESULT RESULT RESOURCE, RETURNS $query_data ARRAY. FOR NOW, limit to QUERIES WITH ONE RESULT. global $SQL_CACHING_ACTIVE, $SQL_STATEMENTS_CACHE, $SQL_DUPES, $SQL_CACHE; $results = array(); if ($SQL_CACHING_ACTIVE && strtolower(substr($sql, 0, 6)) == "select") { if (in_array($sql, $SQL_STATEMENTS_CACHE)) { $SQL_DUPES++; $results = $SQL_CACHE[$sql]; } else { $result = mysql_do($sql); while ($query_data = mysql_fetch_array($result)) { $results[] = $query_data; } $SQL_CACHE[$sql] = $results; $SQL_STATEMENTS_CACHE[] = $sql; } } else { $result = mysql_do($sql); while ($query_data = mysql_fetch_array($result)) { $results[] = $query_data; } } //echo("<i>" . $sql . "</i><br />"); return $results; }
?> <div class="mainContainer"> <div class="ydsf left"> <div class="inner"> <div class="main"> <h2>Projects using evidence with serial number "<?php echo $display_evidence->serial_number; ?> ":</h2> <?php $result = mysql_do("SELECT * FROM evidence WHERE serial_number='{$display_evidence->serial_number}';"); while ($query_data = mysql_fetch_array($result)) { $this_evidence = new Evidence(); $this_evidence->populateFromId($query_data['id']); $this_project = new Project(); $this_project->populateFromId($this_evidence->project_id); if ($this_evidence->name != "" && $this_project->title != "") { ?> <p>Project <a href="<?php echo $base_URL; ?> project/<?php echo $this_project->id; ?> "><?php
** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** ACH 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "../code/includes.php"; $hasEmail = false; if ($_POST['Submit']) { $email = $_POST['email']; $result = mysql_do("SELECT password, username FROM users WHERE email = '{$email}' LIMIT 1"); if ($hit = mysql_fetch_array($result, MYSQL_ASSOC)) { $hasEmail = true; $password = $hit["password"]; $username = $hit["username"]; $subject = "CACH Login Info"; $from = "*****@*****.**"; $to = $_POST['email']; $message = "Your CACH username is '{$username}', and your password is '{$password}'.\r\n\r\n - the CACH robot"; $headers = "From: {$from}\r\nReply-To: {$from}\r\n"; $params = "-f {$from}"; mail($to, $subject, $message, $headers, $params); } else { $error = "We do not have a record with the email <strong>" . $_POST['email'] . "</strong> in our files."; } }
** You should have received a copy of the GNU General Public License ** along with Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "../code/includes.php"; $this_rating = $_REQUEST['new_value']; $evidence_id = $_REQUEST['evidence_id']; $this_evidence_id = substr($evidence_id, 10); $exists = FALSE; $result = mysql_do("SELECT id FROM credibility WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence_id}' LIMIT 1"); while ($query_data = mysql_fetch_array($result)) { $exists = TRUE; } if (!$exists) { mysql_do("INSERT INTO credibility (value, evidence_id, user_id, weight) VALUES ('{$this_rating}', '{$this_evidence_id}', '{$active_user->id}', '1')"); } $result = mysql_do("SELECT id FROM credibility WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence_id}' LIMIT 1"); while ($query_data = mysql_fetch_array($result)) { $active_credibility = new Credibility(); $active_credibility->populateFromId($query_data['id']); $active_credibility->switchCred($this_rating); } ?> <select onChange="saveCredRating('<?php echo $evidence_id; ?> ');" name="<?php echo $evidence_id; ?> " id="<?php echo $evidence_id; ?>
foreach ($_REQUEST as $field => $value) { if (substr($field, 0, 6) == "rating") { $evidence = substr($field, 7, strpos($field, "-") - 7); $hypothesis = substr($field, strpos($field, "-") + 1); mysql_do("DELETE FROM ratings WHERE evidence_id='{$evidence}' AND hypothesis_id='{$hypothesis}' AND user_id='{$active_user->id}'"); if (is_numeric($evidence) && is_numeric($hypothesis)) { mysql_do("INSERT INTO ratings (evidence_id, hypothesis_id, rating, user_id) VALUES ('{$evidence}', '{$hypothesis}', '{$value}', '{$active_user->id}')"); } $value = ""; } if (substr($field, 0, 9) == "cred_edit") { $evidence = substr($field, 10); mysql_do("DELETE FROM credibility WHERE evidence_id='{$evidence}' AND user_id='{$active_user->id}'"); if (is_numeric($evidence)) { $weight = $_REQUEST['cred_weight_edit_' . $evidence]; mysql_do("INSERT INTO credibility (evidence_id, value, weight, user_id) VALUES ('{$evidence}', '{$value}', '{$weight}', '{$active_user->id}')"); } $value = ""; } } setStatusMessage("Done!"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php echo $_REQUEST['project_id']; ?> "> </head>
** You should have received a copy of the GNU General Public License ** along with Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; $active_evidence = new Evidence(); foreach ($_REQUEST as $field => $value) { $active_evidence->{$field} = addslashes($value); } $active_evidence->user_id = $active_user->id; $active_evidence->insertNew(); $cred = $_REQUEST['credibility']; if ($cred == "credible") { mysql_do("INSERT INTO credibility (value, evidence_id, user_id, weight) VALUES ('y', '{$active_evidence->id}', '{$active_user->id}', '1')"); } else { if ($cred == "suspect") { mysql_do("INSERT INTO credibility (value, evidence_id, user_id, weight) VALUES ('n', '{$active_evidence->id}', '{$active_user->id}', '1')"); } } setStatusMessage("Added!"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php echo $active_evidence->project_id; ?> "> </head>
** Copyright 2010 Matthew Burton, http://matthewburton.org ** Code by Burton and Joshua Knowles, http://auscillate.com ** ** This software is part of the Open Source ACH Project (ACH). You'll find ** all current information about project contributors, installation, updates, ** bugs and more at http://competinghypotheses.org. ** ** ** ACH 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, either version 3 of the License, or ** (at your option) any later version. ** ** ACH 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ header("Content-Type: text/plain"); include "code/includes.php"; $message = addslashes($_GET['message']); $project_id = $_GET['project_id']; if ($_GET['insert'] != "n" && $message != "") { mysql_do("INSERT INTO chat_log (user_id, project_id, chat) VALUES ('{$active_user->id}', '{$project_id}', '{$message}');"); } if ($_REQUEST['project_id'] > 0) { showChat($_REQUEST['project_id']); }
include "../code/includes.php"; $this_rating = $_REQUEST['new_value']; $cell_id = $_REQUEST['cell_id']; $evidence_id = substr($cell_id, strpos($cell_id, "_") + 1, strpos($cell_id, "-") - strpos($cell_id, "_") - 1); $hypothesis_id = substr($cell_id, strpos($cell_id, "-") + 1, strpos($cell_id, "_", strpos($cell_id, "-")) - strpos($cell_id, "-") - 1); //echo($evidence_id . " " . $hypothesis_id); $exists = FALSE; $result = mysql_do("SELECT * FROM ratings WHERE evidence_id='{$evidence_id}' AND hypothesis_id='{$hypothesis_id}' AND user_id='{$active_user->id}'"); while ($query_data = mysql_fetch_array($result)) { $exists = TRUE; } //if( $this_rating != "" ) { if ($exists) { mysql_do("UPDATE ratings SET rating='{$this_rating}' WHERE evidence_id='{$evidence_id}' AND hypothesis_id='{$hypothesis_id}' AND user_id='{$active_user->id}'"); } else { mysql_do("INSERT INTO ratings (rating, evidence_id, hypothesis_id, user_id) VALUES ('{$this_rating}', '{$evidence_id}', '{$hypothesis_id}' ,'{$active_user->id}')"); } //} ?> <select onChange="saveCellRating('<?php echo $cell_id; ?> ');" class="table" id="<?php echo $cell_id; ?> " name="<?php echo $cell_id; ?> ">
public function switchCred($toValue) { // Use this to change credibility. global $active_user; $return_value = ""; $this_evidence = new Evidence(); $this_evidence->populateFromId($this->evidence_id); if ($toValue == "y") { $return_value = "Credible"; } else { $return_value = "Suspect"; } if ($this_evidence->serial_number != "") { $result = mysql_do("SELECT id FROM evidence WHERE serial_number='{$this_evidence->serial_number}'"); while ($query_data = mysql_fetch_array($result)) { $exists = FALSE; $this_evidence_id = $query_data['id']; $result2 = mysql_do("SELECT id FROM credibility WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence_id}' LIMIT 1"); while ($query_data2 = mysql_fetch_array($result2)) { $exists = TRUE; } if (!$exists) { mysql_do("INSERT INTO credibility (value, evidence_id, user_id, weight) VALUES ('{$toValue}', '{$this_evidence_id}', '{$active_user->id}', '1')"); } } mysql_do("UPDATE credibility SET value='{$toValue}' WHERE user_id='{$active_user->id}' AND evidence_id IN (SELECT id FROM evidence WHERE serial_number='{$this_evidence->serial_number}')"); } else { mysql_do("UPDATE credibility SET value='{$toValue}' WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence->id}'"); } return $return_value; }
?> );"><?php if ($this_evidence->flag == "y") { echo "<img src='" . $base_URL . "images/icons/flag_red.png' />"; } else { echo "<img src='" . $base_URL . "images/icons/bullet_add.png' />"; } ?> </a></td> <?php for ($j = 0; $j < count($active_project->hypotheses); $j++) { $this_hypothesis = new Hypothesis(); $this_hypothesis->populateFromId($active_project->hypotheses[$j]); $this_rating = ""; $result = mysql_do("SELECT * FROM ratings WHERE evidence_id='{$this_evidence->id}' AND hypothesis_id='{$this_hypothesis->id}' AND user_id='{$ratings_user->id}'"); while ($query_data = mysql_fetch_array($result)) { $this_rating = $query_data['rating']; } $this_rating_style = strtolower(str_replace(" ", "_", str_replace("/", "", $this_rating))); ?> <td class="<?php echo $this_rating_style; ?> "><?php echo $this_rating; ?> </td> <?php }
** 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; include "parts/includes.php"; $project_id = $_REQUEST['id']; $this_project = new Project(); $this_project->populateFromId($project_id); if ($this_project->open == "y") { $result = mysql_do("INSERT INTO users_in_projects (project_id, user_id) VALUES ('{$project_id}', '{$active_user->id}')"); $this_project->mailEveryone("[ACH] New user in project '" . $this_project->title . "'", "Hello,\r\n\r\n" . $active_user->name . " has joined the project '" . $this_project->title . "':\r\n" . $base_URL . "project/" . $this_project->id . "\r\n\r\n - The ACH Bot"); } else { $result = mysql_do("INSERT INTO join_requests (user_id, project_id) VALUES ('{$active_user->id}', '{$project_id}')"); $project_owner = new User(); $project_owner->populateFromId($this_project->user_id); sendMail($project_owner->email, "[ACH] A user has requested to join your project", "Hello,\r\n\r\n" . $active_user->name . " has requested permission to join your project '" . $this_project->title . "'. To respond, please log into your ACH account here:\r\n" . $base_URL . "\r\n\r\nThanks!\r\n\r\n - The ACH Bot"); } ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php echo $project_id; ?> "> </head>
} // Grab the cookie data. if (isset($_COOKIE['cookie_user_id'])) { $cookie_user_id = $_COOKIE['cookie_user_id']; $cookie_user_password = $_COOKIE['cookie_user_password']; $active_user = new User(); $active_user->populateFromID($cookie_user_id); $show_user_menu = TRUE; } else { /*$new_user = new User(); $new_user->username = "******"; $new_user->password = ""; $new_user->insertNew(); $new_user->setCookies(); $cookie_user_id = $new_user->id;*/ $show_user_menu = FALSE; } // Log user in users_active. if ($active_user->logged_in && substr($_SERVER['REQUEST_URI'], 0, 19) != "/insert_message.php" && substr($_SERVER['REQUEST_URI'], 0, 22) != "/show_active_users.php") { $found = false; $result = mysql_do("SELECT id FROM users_active WHERE user_id='{$active_user->id}'"); while ($query_data = mysql_fetch_array($result)) { $found = true; } $this_page = $_SERVER['REQUEST_URI']; if ($found) { mysql_do("UPDATE users_active SET last_visited=NOW(), last_page='{$this_page}' WHERE user_id='{$active_user->id}'"); } else { mysql_do("INSERT INTO users_active (id, user_id, last_visited, last_page, color) VALUES (NULL, '{$active_user->id}', NOW(), '{$this_page}', '000000');"); } }
$this_project->populateFromId($project_id); $this_user = new User(); $this_user->populateFromId($user_id); if ($active_user->id == $this_project->user_id) { if ($action == "approve") { $this_project->mailEveryone("[ACH] New user in project '" . $this_project->title . "'", "Hello,\r\n\r\n" . $this_user->name . " has joined the project '" . $this_project->title . "':\r\n " . $base_URL . "project/" . $this_project->id . "\r\n\r\n - The ACH Bot"); $result = mysql_do("INSERT INTO users_in_projects (project_id, user_id) VALUES ('{$project_id}', '{$user_id}')"); $result = mysql_do("INSERT INTO invitation_notices (user_id, by_user_id, project_Id, type, message) VALUES ('{$user_id}', '{$active_user->id}', '{$project_id}', 'approve', '');"); sendMail($this_user->email, "[ACH] Project join request approved.", "Hello,\r\n\r\nYou have been approved to join project '" . $this_project->title . "':\r\n " . $base_URL . "project/" . $this_project->id . "\r\n\r\n - The ACH Bot"); } else { if ($action == "deny") { $result = mysql_do("INSERT INTO invitation_notices (user_id, by_user_id, project_Id, type, message) VALUES ('{$user_id}', '{$active_user->id}', '{$project_id}', 'deny', '');"); sendMail($this_user->email, "[ACH] Project join request denied.", "Hello,\r\n\r\nYou have been denied access to project '" . $this_project->title . "'.\r\n\r\n - The ACH Bot"); } } mysql_do("DELETE FROM join_requests WHERE user_id='{$user_id}' AND project_id='{$project_id}'"); } ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=<?php echo $base_URL; ?> index.php"> </head> <body>
** along with Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "../code/includes.php"; $this_rating = $_REQUEST['new_value']; $evidence_id = $_REQUEST['evidence_id']; $this_evidence_id = substr($evidence_id, 17); $exists = FALSE; $result = mysql_do("SELECT * FROM credibility WHERE evidence_id='{$this_evidence_id}' AND user_id='{$active_user->id}'"); while ($query_data = mysql_fetch_array($result)) { $exists = TRUE; } //if( $this_rating != "" ) { if ($exists) { mysql_do("UPDATE credibility SET weight='{$this_rating}' WHERE evidence_id='{$this_evidence_id}' AND user_id='{$active_user->id}'"); } else { mysql_do("INSERT INTO credibility (weight, evidence_id, user_id, value) VALUES ('{$this_rating}', '{$this_evidence_id}', '{$active_user->id}', 'y')"); } //} ?> <select onChange="saveCredWeight('<?php echo $evidence_id; ?> ');" name="<?php echo $evidence_id; ?> " id="<?php echo $evidence_id; ?> "> <option value="2" <?php if ($this_rating == "2") {
<?php include "../code/includes.php"; $cookie_user_username = $_REQUEST['cookie_user_username']; $cookie_user_password = md5($_REQUEST['cookie_user_password']); $result = mysql_do("SELECT username, password FROM users WHERE username='******';"); while ($query_data = mysql_fetch_array($result)) { if ($query_data['password'] == $cookie_user_password) { $success = TRUE; } else { $failedlogin = "******"; } } $goto = $_REQUEST['goto'] . $active_user->users[0]; if ($success) { $active_user = new User(); $active_user->populateFromAttribute($_POST['cookie_user_username'], "username"); $active_user->setCookies(); User::successfulLogin(); //print_r($active_user); } else { User::failedLogin(); } if ($_REQUEST['goto']) { $goto = $_REQUEST['goto'] . $active_user->users[0]; } ?> <html> <head> <title>Checking Log In...</title>
public function update() { $table_fields = getFieldList($this->database_table_name); $sql_statement = "UPDATE {$this->database_table_name} SET "; for ($i = 1; $i < count($table_fields); $i++) { $sql_statement .= $table_fields[$i] . "='" . addslashes($this->{$table_fields}[$i]) . "'"; if ($i < count($table_fields) - 1) { $sql_statement .= ", "; } } $sql_statement .= " WHERE id={$this->id};"; mysql_do($sql_statement); $this->id = mysql_insert_id(); return TRUE; }
** 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; $active_user = new User(); $success = TRUE; $fail_text = ""; foreach ($_REQUEST as $field => $value) { $active_user->{$field} = addslashes($value); } if ($_REQUEST['username']) { $result = mysql_do("SELECT * FROM users WHERE username = '******'username'] . "'"); $rows = mysql_num_rows($result); if ($rows == 0) { } else { $success = FALSE; $fail_text .= "<li>That username is already taken. Please try a different username.</li>"; } } else { $success = FALSE; $fail_text .= "<li>You must enter a username.</li>"; } if (strpos($_REQUEST['username'], " ") == FALSE) { } else { $success = FALSE; $fail_text .= "<li>Your username may not contain spaces.</li>"; }
public function displayWaitingForApproval() { $result = mysql_do("SELECT * FROM join_requests WHERE user_id='{$this->id}'"); while ($query_data = mysql_fetch_array($result)) { $this_project = new Project(); $this_project->populateFromId($query_data['project_id']); echo '<p>Still waiting on approval to join project <a href="' . $base_URL . 'project/' . $this_project->id . '">' . $this_project->title . '</a>.</p>'; } }
** You should have received a copy of the GNU General Public License ** along with Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; include "parts/includes.php"; $project_id = $_REQUEST['project_id']; $this_project = new Project(); $this_project->populateFromId($project_id); $viewerEmail = $_REQUEST['viewerEmail']; $found = FALSE; $result = mysql_do("SELECT * FROM users WHERE email='{$viewerEmail}' LIMIT 1"); while ($query_data = mysql_fetch_array($result)) { $user_id = $query_data['id']; $user_name = $query_data['name']; $user_email = $query_data['email']; mysql_do("INSERT INTO users_in_projects_view_only (user_id, project_id) VALUES ('{$user_id}', '{$this_project->id}')"); $found = TRUE; sendMail($user_email, "[ACH] Project view invitation.", "Hello,\r\n\r\nYou have been invited to view project '" . $this_project->title . "':\r\n " . $base_URL . 'project/' . $this_project->id . "\r\n\r\n - The ACH Bot"); } if ($found) { ?> <span class="inviteViewerResult">'<?php echo $user_name; ?> ' added (reload page to see).</span> <?php } else { ?>
** ACH 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, either version 3 of the License, or ** (at your option) any later version. ** ** ACH 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; $project_id = $_REQUEST['id']; $result = mysql_do("DELETE FROM users_in_projects WHERE project_id='{$project_id}' AND user_id='{$active_user->id}'"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php echo $active_evidence->project_id; ?> "> </head> <body>
** 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 Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/common_db.php"; include "code/class_user.php"; include "code/functions.php"; $id = $_REQUEST['id']; $name = $_REQUEST['name']; $campaign_id = $_REQUEST['campaign_id']; $email_address = $_REQUEST['email_address']; $outgoing_message = $_REQUEST['outgoing_message']; mysql_do("UPDATE campaigns SET name='{$name}', campaign_id='{$campaign_id}', outgoing_message='{$outgoing_message}', email_address='{$email_address}' WHERE id='{$id}';"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=campaign/<?php echo $id; ?> "> </head> <body>
public function delete() { $result = mysql_do("SELECT id FROM evidence WHERE project_id='{$this->id}';"); while ($query_data = mysql_fetch_array($result)) { $evidence_id = $query_data['id']; mysql_do("DELETE FROM comments WHERE evidence_id='{$evidence_id}';"); mysql_do("DELETE FROM credibility WHERE evidence_id='{$evidence_id}';"); mysql_do("DELETE FROM evidence WHERE id='{$evidence_id}';"); mysql_do("DELETE FROM ratings WHERE evidence_id='{$evidence_id}';"); } $result = mysql_do("SELECT id FROM hypotheses WHERE project_id='{$this->id}';"); while ($query_data = mysql_fetch_array($result)) { $hypothesis_id = $query_data['id']; mysql_do("DELETE FROM comments WHERE hypothesis_id='{$hypothesis_id}';"); mysql_do("DELETE FROM hypotheses WHERE id='{$hypothesis_id}';"); mysql_do("DELETE FROM ratings WHERE evidence_id='{$hypothesis_id}';"); } mysql_do("DELETE FROM chat_log WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM comments WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM evidence WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM hypotheses WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM invitation_notices WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM join_requests WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM users_in_projects WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM users_in_projects_view_only WHERE project_id='{$this->id}';"); mysql_do("DELETE FROM projects WHERE id='{$this->id}';"); }
<div class="inner"> <div class="main"> <h2>Browse Public Projects</h2> <p>The projects below may be viewed by anyone.<br /> Those with a lock ( <span class="closed"><img src="<?php echo $base_URL; ?> images/icons/lock.png" alt="Closed" /></span> ) are still publicly viewable, but require the owner's permission for you to join.</p> <?php $active_user->getProjects(); $result = mysql_do("SELECT * FROM projects WHERE directory='y' ORDER BY title"); while ($query_data = mysql_fetch_array($result)) { $this_project = new Project(); $this_project->populateFromId($query_data['id']); ?> <div class="projectList"> <h4><a href="<?php echo $base_URL; ?> project/<?php echo $this_project->id; ?> "><?php echo $this_project->title;
function showChat($project_id) { global $base_URL; $messages = false; $result = mysql_do("SELECT * FROM chat_log WHERE project_id='{$project_id}' ORDER BY created DESC LIMIT 50;"); while ($query_data = mysql_fetch_array($result)) { $messages = true; $this_user = new User(); $this_user->populateFromId($query_data['user_id']); $result_2 = mysql_do("SELECT * FROM users_active WHERE user_id='{$this_user->id}' LIMIT 1;"); while ($query_data_2 = mysql_fetch_array($result_2)) { echo '<p><span class="date">' . $query_data['created'] . '</span> <span class="name"><a href="' . $base_URL . 'profile/' . $this_user->username . '" style="color: #' . $query_data_2['color'] . ';">' . $this_user->name . '</a></span>: <span class="message">' . $query_data['chat'] . '</span></p>'; } } if (!$messages) { echo '<p><span class="none">No chat messages yet.</span></p>'; } }
$this_rating = "Inconsistent"; } if ($values[$j] == "NA") { $this_rating = "N/A"; } if ($values[$j] == "N") { $this_rating = "Neutral"; } if ($values[$j] == "C") { $this_rating = "Consistent"; } if ($values[$j] == "C C") { $this_rating = "Very Consistent"; } $this_hypothesis_id = $this_hypothesis[$j]->id; mysql_do("INSERT INTO `ratings` (`hypothesis_id`,`evidence_id`,`user_id`,`rating`) VALUES ('{$this_hypothesis_id}', '{$this_evidence->id}', '{$active_user->id}', '{$this_rating}');"); } $this_credibility = new Credibility(); $this_credibility->evidence_id = $this_evidence->id; $this_credibility->user_id = $active_user->id; if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "HIGH") { $this_credibility->value = "y"; } if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "MEDIUM") { $this_credibility->value = "y"; } if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "LOW") { $this_credibility->value = "n"; } $this_credibility->weight = 1; $this_credibility->insertNew();