Exemplo n.º 1
0
     $value['imp'] = $_POST['i_value'];
     $value['prf'] = $_POST['pr_value'];
     //  print_r($value);
     $data = json_encode($value, true);
     $id = AdminRateProject($value);
     //print_r($id);
     if ($id) {
         $score = calculate_mr($_POST['project_id']);
         updateProjectSeed($_POST['project_id'], $score);
         $project_title = getProjectTitle($_POST['project_id']);
         $sent_to = getProjectAuthor($_POST['project_id']);
         $author = getUserNameById($_SESSION['uid']);
         $url = SITE_URL . '/home.php?pid=' . $_POST['project_id'];
         $text = $author . ' rated project ' . $project_title;
         addNotification($sent_to, $text, $_SESSION['uid'], $url);
         addInteraction($_SESSION['uid'], 'rate', $sent_to, 'project', $_POST['project_id']);
         $responce['result'] = 'OK';
     } else {
         $responce['result'] = '';
     }
     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';
Exemplo n.º 2
0
        break;
    case 'add-idea-comment':
        require_once DIR_APP . 'projects.php';
        require_once DIR_APP . 'users.php';
        $id = addIdeaComment($_POST['ideathread_id'], $_SESSION['uid'], $_POST['text']);
        plusInteraction($_POST['ideathread_id']);
        if (!empty($id)) {
            $responce['result'] = 'OK';
            $responce['id'] = $id;
            $ideathread_title = getIdeaTitle($_POST['ideathread_id']);
            $sent_to = getIdeaAuthor($_POST['ideathread_id']);
            $author = getUserNameById($_SESSION['uid']);
            $url = SITE_URL . '/home.php?iid=' . $_POST['ideathread_id'];
            $text = ucwords($author) . ' commented on your ideathread ' . $ideathread_title;
            addNotification($sent_to, $text, $_SESSION['uid'], $url);
            addInteraction($_SESSION['uid'], 'comment', $sent_to, 'ideathread', $_POST['ideathread_id']);
            $messages = getIdeaComments($_POST['ideathread_id']);
            $content = '';
            foreach ($messages as $ix => $m) {
                $content .= '<div class="message-item';
                if ($ix % 2 == 0) {
                    $content .= ' odd';
                }
                $content .= '" data-id="' . $ix . '">
 						<div class="message-author">';
                $u = getUserData($m['created_by']);
                $content .= '<div class="router-user-photo">
        				<a href="user.php?uid=' . $u['user_id'] . '">';
                if (empty($u['photo'])) {
                    $content .= '<img src="uploads/avatars/nophoto.jpg" alt="">';
                } else {