$user = $_GET['uid']; } else { $user = $_SESSION['uid']; } $interactions = getInteractions($user); if ($interactions) { foreach ($interactions as $i) { $timestamp = $i['created_on']; $user = getUserNameById($i['created_by']); $author = getUserNameById($i['author']); if ($i['type'] == 'ideathread') { $title = getIdeaTitle($i['id']); $url = SITE_URL . '/home.php?iid=' . $i['id']; } if ($i['type'] == 'project') { $title = getProjectTitle($i['id']); $url = SITE_URL . '/home.php?pid=' . $i['id']; } if ($i['action'] == 'like') { $action = 'liked'; $icon_image = SITE_URL . '/images/icons/like.png'; } if ($i['action'] == 'comment') { $action = 'commented on'; $icon_image = SITE_URL . '/images/icons/comment.jpg'; } if ($i['action'] == 'rate') { $action = 'rated'; $icon_image = SITE_URL . '/images/icons/star.jpg'; } if ($i['action'] == 'route') {
include 'includes/config.php'; require_once DIR_APP . 'projects.php'; $projs = getRecentProjects(); foreach ($projs as $project) { $seedrating = calculate_mr($project['project_id']); if ($seedrating == 'N/A') { continue; } if ($project['status'] == '1') { continue; } $user = '******'; //automatically published need to define user $query = "UPDATE `projects` SET `status`='1',`accepted_by`=" . $user . " WHERE `project_id`=" . $project['project_id']; $db_con->query($query); $project_title = getProjectTitle($project['project_id']); $url = SITE_URL . '/home.php?pid=' . $project['project_id']; $sent_to = getProjectAuthor($project['project_id']); $text = 'Your Project "' . $project_title . '" has been Published.'; addNotification($sent_to, $text, 168, $url); //automatically published need to define user } $projects = getAllRecentProjects(); foreach ($projects as $project) { $seedrating = calculate_mr($project['project_id']); if ($seedrating == 'N/A') { continue; } $likes = getLikesCount($project_id); $comments = getCommentsCount($project_id); $query = 'SELECT `routed_by` FROM `routed_projects` WHERE `project_id` = ' . $project_id;
if ($delete == "y") { $query = "delete from items where itemId='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); $query = "delete from itemattributes where itemId='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); $query = "delete from itemstatus where itemId='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); echo '<META HTTP-EQUIV="Refresh" CONTENT="1; url=projectReport.php?projectId=' . $projectId . '" />'; echo "<p>Number of Records Deleted: "; echo mysql_affected_rows(); if (nextAction == 'y') { $query = "delete from nextactions where nextAction='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); } } else { $projectTitle = getProjectTitle($projectId); $query = "UPDATE items\n SET description = '{$description}', title = '{$title}'\n WHERE itemId = '{$itemId}'"; $result = mysql_query($query) or die("Error in query"); $query = "UPDATE itemattributes\n\t\tSET type = '{$type}', projectId = '{$projectId}', contextId = '{$contextId}', timeframeId = '{$timeframeId}', \n\t\tdeadline ='{$deadline}', `repeat` = '{$repeat}', suppress='{$suppress}', suppressUntil='{$suppressUntil}' \n\t\tWHERE itemId = '{$itemId}'"; $result = mysql_query($query) or die("Error in query"); $query = "UPDATE itemstatus\n\t\tSET dateCompleted = '{$dateCompleted}'\n\t\tWHERE itemId = '{$itemId}'"; $result = mysql_query($query) or die("Error in query"); if ($nextAction == 'y') { $query = "INSERT INTO nextactions (projectId,nextaction) VALUES ('{$projectId}','{$itemId}') \n\t\t\tON DUPLICATE KEY UPDATE nextaction='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); } else { $query = "DELETE FROM nextactions WHERE nextAction='{$itemId}'"; $result = mysql_query($query) or die("Error in query"); } echo '<META HTTP-EQUIV="Refresh" CONTENT="1; url=projectReport.php?projectId=' . $projectId . '" />'; }
echo json_encode($responce); break; case 'assign-rater': require_once DIR_APP . 'users.php'; require_once DIR_APP . 'projects.php'; $id = AddRaterToProject($_POST['project_id'], $_SESSION['uid'], $_POST['sent_to']); if (!empty($id)) { if ($id == 'limit') { $responce['result'] = 'LIMIT'; } else { $responce['result'] = 'OK'; $responce['id'] = $id; $responce['user_id'] = $_POST['sent_to']; $responce['user'] = getUserNameById($_POST['sent_to']); // addSuggestion($_POST['project_id'], $_POST['sent_to'], $_SESSION['uid']); $project_title = getProjectTitle($_POST['project_id']); $author = getUserNameById($_SESSION['uid']); $url = SITE_URL . '/project_details.php?pid=' . $_POST['project_id']; $text = $author . ' assigned to rate project ' . $project_title; addNotification($_POST['sent_to'], $text, $_SESSION['uid'], $url); } } else { $responce['result'] = 'FALSE'; } echo json_encode($responce); break; case 'register-profiled': require_once DIR_APP . 'users.php'; require_once DIR_APP . 'projects.php'; $id = registerProfile($_POST); if ($id == true) {