Example #1
0
     $res = rejectBlogPost($post_id);
     $project_title = getBlogPostTitle($post_id);
     //$author = getUserNameById($_SESSION['uid']);
     $url = SITE_URL . '/blog.php?id=' . $post_id;
     $sent_to = getBlogPostAuthor($post_id);
     $text = 'Your Blog Post  "' . $project_title . '" has been Rejected.';
     addNotification($sent_to, $text, $_SESSION['uid'], $url);
     $responce['result'] = 'OK';
     echo json_encode($responce);
     break;
 case 'reject-ideathread':
     require_once DIR_APP . 'users.php';
     require_once DIR_APP . 'projects.php';
     $ideathread_id = $_POST['ideathread_id'];
     $res = rejectIdeathread($ideathread_id);
     $project_title = getIdeaTitle($ideathread_id);
     //$author = getUserNameById($_SESSION['uid']);
     $url = SITE_URL . '/home.php?iid=' . $ideathread_id;
     $sent_to = getIdeaAuthor($ideathread_id);
     $text = 'Your Ideathread  "' . $project_title . '" has been Rejected.';
     addNotification($sent_to, $text, $_SESSION['uid'], $url);
     $responce['result'] = 'OK';
     echo json_encode($responce);
     break;
 case 'reject-project':
     require_once DIR_APP . 'users.php';
     require_once DIR_APP . 'projects.php';
     $project_id = $_POST['project_id'];
     $res = rejectProject($project_id);
     $project_title = getProjectTitle($project_id);
     //$author = getUserNameById($_SESSION['uid']);
if (empty($_SESSION['logged_in'])) {
    redirect('index.php');
}
if (isset($_GET['uid'])) {
    $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') {
Example #3
0
            }
            $responce['content'] = $content;
        } else {
            $responce['result'] = '';
        }
        echo json_encode($responce);
        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">';