Пример #1
0
 public function deleteComment($commentId = -1)
 {
     $response['signed'] = false;
     $response['succeeded'] = false;
     if (isset($_SESSION["user_id"]) && strlen(trim($_SESSION["user_id"])) > 0 && $commentId != -1) {
         $response['signed'] = true;
         deleteComment($commentId);
         $response['succeeded'] = true;
     }
     echo json_encode($response);
 }
Пример #2
0
function commentCon($id, $action)
{
    switch ($action) {
        case '1':
            deleteComment($id);
            break;
        case '2':
            cancleInformComment($id);
        default:
            break;
    }
}
function admin_plugin_comments_run(&$loq)
{
    // Again, the plugin API needs work.
    $commentAmount = 50;
    if (isset($_POST['commentsQuantity'])) {
        if ($_POST['commentsQuantity'] == 'ALL') {
            $commentAmount = 'ALL';
        } else {
            $commentAmount = intval($_POST['commentsQuantity']);
        }
    }
    $commentAmount = isset($_POST['commentsQuantity']) ? intval($_POST['commentsQuantity']) : 50;
    $articles = null;
    if (isset($_POST['commentsPosts'])) {
        $articles = $_POST['commentsPosts'] === 'All' ? null : intval($_POST['commentsPosts']);
    }
    $commentdo = isset($_POST['commentdo']) ? strtolower($_POST['commentdo']) : '';
    if ($commentdo == '') {
        $commentdo = isset($_GET['commentdo']) ? strtolower($_GET['commentdo']) : '';
    }
    switch ($commentdo) {
        case "delete":
            // delete comments
            if (is_array($_POST['commentid'])) {
                foreach ($_POST['commentid'] as $key => $val) {
                    deleteComment($loq, $val, $_POST['postid'][$val]);
                }
            }
            break;
        case "edit":
            $commentid = intval($_GET['editComment']);
            $postid = intval($_GET['postid']);
            editComment($loq, $commentid, $postid);
            break;
        case "editsave":
            saveEdit($loq);
            break;
        case "approve":
            if (is_array($_POST['commentid'])) {
                foreach ($_POST['commentid'] as $key => $val) {
                    $loq->_adb->Execute("UPDATE " . T_COMMENTS . " SET onhold='0' WHERE commentid='" . intval($val) . "'");
                }
            }
            break;
        case "filter":
        default:
            // show form
            break;
    }
    retrieveComments($loq, $commentAmount, $articles);
    populateSelectList($loq);
}
Пример #4
0
/**
* Main function of plugin
*
* @param object $bBlog Instance of bBlog object
* @return void
*
*/
function admin_plugin_comments_run(&$bBlog)
{
    // Again, the plugin API needs work.
    $commentAmount = 50;
    if (isset($_GET['commentdo'])) {
        $commentdo = $_GET['commentdo'];
    } elseif (isset($_POST['commentdo'])) {
        $commentdo = $_POST['commentdo'];
    } else {
        $commentdo = "";
    }
    switch ($commentdo) {
        case "Delete":
            // delete comments
            if (is_array($_POST['commentid'])) {
                foreach ($_POST['commentid'] as $key => $val) {
                    deleteComment(&$bBlog, $val);
                }
            }
            break;
        case "Edit":
            $commentid = intval($_GET['editComment']);
            $postid = intval($_GET['postid']);
            editComment(&$bBlog, $commentid, $postid);
            break;
        case "editsave":
            saveEdit(&$bBlog);
            break;
        case "Approve":
            if (is_array($_POST['commentid'])) {
                foreach ($_POST['commentid'] as $key => $val) {
                    $bBlog->query("UPDATE " . T_COMMENTS . " SET onhold='0' WHERE commentid='" . intval($val) . "'");
                }
            }
            break;
        case "25":
        case "50":
        case "100":
        case "150":
        case "200":
            $commentAmount = intval($commentdo);
            break;
        default:
            // show form
            break;
    }
    retrieveComments(&$bBlog, $commentAmount);
    populateSelectList(&$bBlog);
}
<?php

include "../util/DbUtil.php";
session_start();
$commentid = $_POST['commentid'];
$response = "";
$db_conn = getConnectedDb();
if (is_null($db_conn)) {
    $response = "Error connecting to database. Try again later.";
} elseif (!deleteComment($db_conn, $commentid)) {
    $response = "Comment unable to be deleted for unknown reason.";
} else {
    $response = "success";
}
echo $response;
Пример #6
0
define('__TEXTCUBE_MOBILE__', true);
if (empty($suri['id'])) {
    $IV = array('POST' => array('replyId' => array('id'), 'password' => array('string', 'mandatory' => false)));
}
require ROOT . '/library/preprocessor.php';
requireView('mobileView');
requireStrictRoute();
if (empty($suri['id'])) {
    list($entryId) = getCommentAttributes($blogid, $_POST['replyId'], 'entry');
    if (deleteComment($blogid, $_POST['replyId'], $entryId, isset($_POST['password']) ? $_POST['password'] : '') === false) {
        printMobileErrorPage(_text('댓글을 삭제할 수 없습니다.'), _text('비밀번호가 일치하지 않습니다.'), $context->getProperty('uri.blog') . "/comment/delete/{$_POST['replyId']}");
        exit;
    }
} else {
    list($entryId) = getCommentAttributes($blogid, $suri['id'], 'entry');
    if (deleteComment($blogid, $suri['id'], $entryId, '') === false) {
        printMobileErrorPage(_t('댓글을 삭제할 수 없습니다'), _t('관리자가 아닙니다'), $context->getProperty('uri.blog') . "/comment/delete/{$suri['id']}");
        exit;
    }
}
list($entries, $paging) = getEntryWithPaging($blogid, $entryId);
$entry = $entries ? $entries[0] : null;
printMobileHtmlHeader();
?>
<div id="content">
	<h2><?php 
echo _t('댓글이 삭제됐습니다');
?>
</h2>
</div>
<?php 
Пример #7
0
         }
         $responce['content'] = $content;
     } else {
         $responce['result'] = '';
     }
     echo json_encode($responce);
     break;
 case 'report-project':
     require_once DIR_APP . 'projects.php';
     reportProject($_POST['project_id'], $_POST['copyright'], $_POST['spam'], $_POST['violent'], $_POST['abusive'], $_POST['impersonation'], $_POST['harassment']);
     $responce['result'] = 'OK';
     echo json_encode($responce);
     break;
 case 'delete-comment':
     require_once DIR_APP . 'projects.php';
     deleteComment($_POST['comment_id']);
     $responce['result'] = 'OK';
     echo json_encode($responce);
     break;
 case 'delete-idea-comment':
     require_once DIR_APP . 'projects.php';
     deleteIdeaComment($_POST['comment_id']);
     minusInteraction($_POST['ideathread_id']);
     $responce['result'] = 'OK';
     echo json_encode($responce);
     break;
 case 'delete-idea':
     require_once DIR_APP . 'projects.php';
     deleteIdea($_POST['ideathread_id']);
     $response['result'] = 'OK';
     echo json_encode($response);
Пример #8
0
/*
** Controls all User-specific functionalities
** E.g Create user, Delete user, Edit user, Search user, Logout user
*/
include "config.php";
session_start();
//get action var: action|''
$action = isset($_POST['action']) ? $_POST['action'] : "";
//controls what to show in the front page
switch ($action) {
    case 'addComment':
        addComment();
        break;
    case 'deleteComment':
        deleteComment();
        break;
    case 'editComment':
        editComment();
        break;
    default:
        homepage();
}
function addComment()
{
    $comment = new Comment();
    $comment->storeFormValues($_POST);
    $comment->insertComment();
}
function deleteComment()
{
Пример #9
0
if ($act === 'signup') {
    $msg = signup();
} elseif ($act === 'login') {
    $msg = login();
} elseif ($act === 'logout') {
    $msg = logout();
} elseif ($act === 'post') {
    $msg = post();
} elseif ($act === 'deletePost') {
    $msg = deletePost();
} elseif ($act === 'likePost') {
    $msg = likePost();
} elseif ($act === 'commentPost') {
    $msg = commentPost();
} elseif ($act === 'deleteComment') {
    $msg = deleteComment();
} elseif ($act === 'changeInfo') {
    $msg = changeInfo();
} elseif ($act === 'readNotify') {
    $msg = readNotify();
} elseif ($act === 'markAllRead') {
    $msg = markAllRead();
}
?>
 <!DOCTYPE HTML>
 <html>
 <head>
 <meta charset="utf-8">
 <meta name="description" content="">
 <meta name="keywords" content="">
 <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
Пример #10
0
    }
    if (isset($_POST['reply'])) {
        print replyComment();
    }
    if (isset($_POST['profile_pic'])) {
        print changeProfilePic();
    }
    if (isset($_POST['changeInfo'])) {
        print changeInfo();
    }
    if (isset($_POST['del_user'])) {
        deleteUser();
    }
    if (isset($_POST['del_post'])) {
        print deletePost();
    }
    if (isset($_POST['del_comment'])) {
        print deleteComment();
    }
    if (isset($_POST['recycle'])) {
        print recycle();
    }
    if (isset($_POST['follow'])) {
        print follow();
    }
    if (isset($_POST['unfollow'])) {
        print follow();
    }
    print '</h3><button type="button" id="hide_btn" class="button">close</button>';
    print '</div>';
}
Пример #11
0
}
$currentNews = getNewsData($newsId);
if (isset($_POST['submit'])) {
    $postNewsId = intval($_POST['newsId']);
    $postCommentId = intval($_POST['commentId']);
    if ($postCommentId == -1) {
        sendComments($postNewsId, $_POST['userComment']);
    } else {
        updateComment($postCommentId, $_POST['userComment']);
    }
    header("Location: comments.php?news={$postNewsId}");
    exit;
}
if (isset($_POST['delete'])) {
    $postCommentId = intval($_POST['commentId']);
    deleteComment($postCommentId);
}
?>

<script>
    
    function deleteComment(newsId, commentId)
    {
        $.post
        (
            "comments.php",
            {
                'commentId' : commentId,
                'delete'    : true
            }
        ).done(function() {
Пример #12
0
<?php

if (isset($_POST['NewComment']) && $_SESSION['csrf'] == $_POST['csrf']) {
    newComment($_POST['Event_ID'], $_POST['User_ID'], $_POST['NewCommentText']);
}
if (isset($_POST['DeleteComment']) && $_SESSION['csrf'] == $_POST['csrf']) {
    if (checkIfCommentExists($_POST['Comment_ID'])) {
        deleteComment($_POST['Comment_ID']);
    }
}
Пример #13
0
     $response = getVotes($itemid);
     break;
     /** FOLLOWING **/
 /** FOLLOWING **/
 case "addfollowing":
     $itemid = required_param('itemid', PARAM_ALPHANUMEXT);
     $response = addFollowing($itemid);
     break;
 case "deletefollowing":
     $itemid = required_param('itemid', PARAM_ALPHANUMEXT);
     $response = deleteFollowing($itemid);
     break;
 case "deletecomment":
     $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
     $parentconnid = optional_param('parentconnid', "", PARAM_ALPHANUMEXT);
     $response = deleteComment($nodeid, $parentconnid);
     break;
 case "connectnodetocomment":
     $comment = required_param('comment', PARAM_TEXT);
     $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
     $nodetypename = required_param('nodetypename', PARAM_TEXT);
     $parentconnid = optional_param('parentconnid', "", PARAM_ALPHANUMEXT);
     $parentid = optional_param('parentid', "", PARAM_ALPHANUMEXT);
     $response = connectNodeToComment($nodeid, $nodetypename, $comment, $parentconnid, $parentid, $style);
     break;
 case "auditsearch":
     $query = required_param('q', PARAM_TEXT);
     $tagsonlyoption = optional_param('tagsonly', 'N', PARAM_TEXT);
     $type = optional_param('type', 'main', PARAM_ALPHA);
     $typeitemid = optional_param('typeitemid', '', PARAM_TEXT);
     $searchid = "";
Пример #14
0
         $message = json_encode($message);
         $gcm = new GCMmanager();
         $type = "Group Feed Comment";
         $gcm->sendPush($deviceIDs, $message, $type);
         //echo alertForDevotionComment($cid,$devotionDetails,$churchID,$memberID,$username);
         echo trim('Saved');
         exit;
     } else {
         echo "Not saved";
         exit;
     }
 } else {
     if ($reason == "Delete Feed Comment") {
         $cid = $_POST['topicid'];
         //$query="Delete from `daily_guide_lessons_comments` where `daily_guide_lessons_comment_id`='$cid' ";
         echo $results = deleteComment($cid);
         exit;
     } else {
         if ($reason == "Save Nsore Group Feed") {
             $username = "******";
             $title = "";
             if (isset($_POST['reason'])) {
                 $cid = $_POST['GID'];
                 $data = $_POST['userpost'];
                 if (isset($_POST['UN'])) {
                     $uname = $_POST['UN'];
                 }
                 $date = date('Y-m-d');
                 $memberID = $_POST['senderid'];
             } else {
                 $cid = $_GET['GID'];
Пример #15
0
include_once 'modele/news/getComments.php';
$commentArray = getComment($id);
foreach ($commentArray as $com) {
    $pseudo = $com['pseudo'];
    $id_user = $com['ID_membre'];
    $id_news = $com['ID_news'];
}
if (!isset($pseudo)) {
    $js = false;
    $redirect[0] = 'javascript:history.go(-1)';
    $redirect[1] = '1';
    $page = 'accueil';
    $titreErreur = 'news - erreur';
    $erreur = 'Ce commentaire n\'existe pas !';
    include_once 'vue/erreur.php';
    die;
}
$admin = areYouAdmin();
if (!$admin and (!$_SESSION['login'] or $id_user != $_SESSION['ID'])) {
    $js = false;
    $redirect[0] = 'javascript:history.go(-1)';
    $redirect[1] = '1';
    $page = 'accueil';
    $titreErreur = 'news - erreur';
    $erreur = 'Vous n\'êtes pas autorisé à supprimer un commentaire qui ne vous appartient pas!';
    include_once 'vue/erreur.php';
    die;
}
include_once 'modele/news/ajoutComment.php';
deleteComment($id);
include_once 'vue/news/delete-comment.php';
Пример #16
0
<?php

include "../universal/config.php";
//---saveComment---//
if (isset($_POST["saveComment"])) {
    include "saveComment.php";
    $result = saveComment($_POST["commentid"], $_POST["q"], $_POST["commentText"]);
    echo $result;
} elseif (isset($_POST["editComment"])) {
    include "editComment.php";
    $result = editComment($_POST["commentid"]);
    echo $result;
} elseif (isset($_POST["deleteComment"])) {
    include "deleteComment.php";
    $result = deleteComment($_POST["commentid"]);
    echo $result;
} elseif (isset($_POST["showComments"])) {
    include "showComments.php";
    $result = showComments($_POST["q"]);
    echo $result;
}
$dbname = "dev";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$error = false;
$error_message = "";
$data = json_decode(file_get_contents('php://input'), true);
$user = $data["username"];
$poster = $data["poster"];
$time = $data["time"];
$pid = $data["pid"];
$channelname = $data["channelname"];
$channelowner = $data["channelowner"];
if (isAdmin($conn, $user) || isOwner($conn, $user, $channelname, $channelowner) || isModerator($conn, $user, $channelname, $channelowner)) {
    deleteComment($conn, $poster, $time, $pid, $channelname, $channelowner);
} else {
    $error = true;
    $error_message = "You do not have permission to delete posts from this channel";
}
$conn->close();
$response = array('error' => $error, 'error_message' => $error_message, 'channelname' => $channelname, 'channelowner' => $channelowner, 'pid' => $pid, 'poster' => $poster, 'time' => $time);
echo json_encode($response);
function deleteComment($conn, $user, $time, $pid, $channelname, $channelowner)
{
    global $error, $error_message;
    $stmt = $conn->prepare("DELETE FROM post_comments WHERE \n                pc_username=? AND pc_time=? AND pc_chname=? AND pc_chowner=? AND pc_number=?");
    $stmt->bind_param("ssssi", $user, $time, $channelname, $channelowner, $pid);
    $stmt->execute();
    $stmt->close();
}
Пример #18
0
<?php

include 'db-connection.php';
require 'posts.php';
session_start();
$comment_id = filter_input(INPUT_POST, 'commentId');
$user_id = $_SESSION['user_id'];
$status = deleteComment($comment_id, $user_id);
echo $status;
Пример #19
0
     $kommentariUtils = KommentariUtils::getInstance();
     $cid = $utils->iStr($app->request()->post('id'), 64);
     $lnk = $kommentariUtils->placeTmpLink($cid);
     $res = array('req' => 'callTmpTarget', 'cid' => $cid, 'lnk' => $lnk);
     break;
 case 'profile-image-upload':
     $res = uploadProfileImage($app);
     break;
 case 'release-comment':
     $res = releaseComment($app);
     break;
 case 'list-comments':
     $res = listTenantComments($app);
     break;
 case 'delete-comment':
     $res = deleteComment($app);
     break;
 case 'update-user':
     $uid = $utils->iStr($app->request()->post('uid'), 128);
     $mail = $utils->iStr($app->request()->post('mail'), 128);
     $name = $utils->iStr($app->request()->post('name'), 128);
     $pass = $utils->iStr($app->request()->post('pass'), 128);
     $mble = $utils->iStr($app->request()->post('mobile'), 128);
     $targetUser = new User($uid);
     $m = $targetUser->getModel();
     $m['mail'] = $mail;
     $m['name'] = $name;
     $m['password'] = $pass;
     $m['mobile'] = $mble;
     $res = $targetUser->update($m);
     $res = ['req' => 'updateUser', 'res' => 'false', 'uid' => $uid, 'err' => L::__('Not implemented.')];
Пример #20
0
/** APPROVE COMMENT **/
if (isset($_GET['approve'])) {
    $comment_id = $_GET['approve'];
    approveComment($comment_id);
    $success_message = "Comment approved successfully";
}
/** UNAPPROVE COMMENT **/
if (isset($_GET['unapprove'])) {
    $comment_id = $_GET['unapprove'];
    unapproveComment($comment_id);
    $success_message = "Comment unapproved successfully";
}
/** DELETE COMMENT **/
if (isset($_GET['delete'])) {
    $comment_id = $_GET['delete'];
    deleteComment($comment_id);
    $success_message = "Comment deleted successfully";
}
?>

<div id="wrapper">

<?php 
require "includes/admin_navigation.php";
?>

    <div id="page-wrapper">

        <div class="container-fluid">

            <!-- Page Heading -->
Пример #21
0
<?php

session_start();
include "carpoolingDAO.php";
$commentId = $_POST["commentId"];
deleteComment($commentId);
?>

Пример #22
0
     break;
 case "comments":
     switch ($method) {
         case "GET":
             $results = getComments($data);
             break;
         case "POST":
             $results = addComment($data);
             break;
         case "PATCH":
             $data["commentID"] = $path[1];
             $results = editComment($data);
             break;
         case "DELETE":
             $data["commentID"] = $path[1];
             $results = deleteComment($data);
             break;
         default:
             $results["meta"] = methodNotAllowed($method, $path);
     }
     break;
 case "follows":
     switch ($method) {
         case "POST":
             $results = addFriend($data);
             break;
         case "DELETE":
             $results = deleteFriend($data);
             break;
         default:
             $results["meta"] = methodNotAllowed($method, $path);
Пример #23
0
//Inclusion des fonctions relatives aux membres
include_once "modele/fonctionsdb.php";
//Test si maintenance
if (returnValueFromParam("maintenanceMode") == "true") {
    header("Location: maintenance.php");
}
//Session checker 3000
if (empty($_SESSION)) {
    header("Location: connexion.php");
} else {
    //Affichage "Bienvenue, pseudo" + déco
    $menu = true;
}
//Test permissions
$access = RankingComment($_SESSION["pseudo"]);
if ($access["miaounet_mod"] == "0") {
    header("Location: index.php");
}
if (isset($_GET["id"])) {
    $postToEdit = AffichageComment($_GET["id"]);
    if (!empty($postToEdit)) {
        deleteComment($_GET["id"]);
        $deleted = true;
    } else {
        $deleted = false;
    }
} else {
    $deleted = false;
}
$title = "Suppression de commentaire";
include_once "vue/delete_comment.php";
Пример #24
0
<?php
	$page_title = "Kommentaaride modereerimine";
	$page_file_name = "moderate.php";
	require_once("../header.php");
	require_once("../functions.php");
?>
<Title><?php echo $page_title?></title>

<?php

if(isset($_GET["delete"])) {
		deleteComment($_GET["delete"]);
	}

if(isset($_GET["accept"])) {
		acceptComment($_GET["accept"]);
	}

$keyword = "";
	if(isset($_GET["keyword"])){
		$keyword = $_GET["keyword"];

		$procomments_array = getAllData($keyword);

	}else{
		$procomments_array = getAllData();
	}
?>
<h1>Kommentaarid</h1>
	<form action="moderate.php" method="get">
		<div class="col-sm-6">
        if ($_SERVER["HTTPS"] !== "off") {
            $commentId = $rm->cleanData($_POST['commentId']);
            $postId = $rm->cleanData($_POST['postId']);
            $getArrayList = array();
            //echo $ENCRYPTEDPWD = md5($PASSWORD);
            //echo $ENCRYPTEDPWD = base64_decode($PASSWORD);
            //$ENCRYPTEDPWD=$PASSWORD;
            if ($commentId == "" || $postId == "") {
                $result = $rm->fields_validation();
                return $result;
            } else {
                $affectedRowsDeleteComment = $rm->deleteComment($commentId);
                if ($affectedRowsDeleteComment > 0) {
                    $result = $rm->deleteCommentSuccessJson($postId);
                    return $result;
                } else {
                    $result = $rm->deleteCommentFailJson();
                    return $result;
                }
            }
        } else {
            $result = $rm->ssl_error();
            return $result;
        }
    } else {
        $result = $rm->ssl_error();
        return $result;
    }
}
echo deleteComment();
Пример #26
0
function deleteComment($commentID)
{
    global $logged;
    global $oProfile;
    $commentID = (int) $commentID;
    if ($oProfile->owner || $logged['admin']) {
        $del = db_res("SELECT `ID` FROM `ProfilesComments` WHERE `ReplyTO` = '{$commentID}' ");
        while ($del_arr = mysql_fetch_array($del)) {
            deleteComment($del_arr['ID']);
        }
        db_res("DELETE FROM `ProfilesComments` WHERE `ID` = '{$commentID}'");
    }
}
if ($action == 'd') {
    if ($target == 's') {
        $story = getStory($item_ID);
        if ($uid == $story["poster_id"]) {
            deleteStory($item_ID);
            header("Location: ../index.php");
            exit;
        } else {
            header("Location: ../index.php?error=1");
            exit;
        }
    } else {
        if ($target == 'c') {
            $comment = getComment($item_ID);
            if ($uid == $comment["commenter_id"]) {
                deleteComment($item_ID);
                header("Location: ../story.php?id=" . $origin);
                exit;
            } else {
                header("Location: ../index.php?error=1");
                exit;
            }
        }
    }
} else {
    if ($action == 'e') {
        if (isset($_POST['content'])) {
            if ($target == 's') {
                $stmt = $mysqli->prepare("update stories set commentary = ? where story_id = ?");
                if (!$stmt) {
                    printf("Query Prep Failed: %s\n", $mysqli->error);
Пример #28
0
<?php

session_start();
if (!session_is_registered("BLOG_LOGIN")) {
    header("location:login.php");
}
?>
 
 <?php 
require_once 'header.php';
require_once 'functions.php';
ob_start();
require_once 'db_connection.php';
if ($_GET['action'] == 'delete') {
    deleteComment($_GET['commentid']);
    //header("location:admin.php");
}
?>
	<table style="width:100%;">
		<tr valign="top">
		<td class="mainleft">

	<div align="center"><h1>Admin area - View Comments</h1></div>
	<table style="width: 100%" border="0" cellpadding="5" align="center">
        <tr>
            <td style="width: 20%"><b>Comment By</b></td>
            <td style="width: 50%" align="center"><b>Text</b></td>
			<td style="width: 20%" align="center"><b>Created</b></td>			
			<td align="center"><b>Actions</b></td>
        </tr>
<?php 
Пример #29
0
/**
 * Processes loading of this sample code through a web browser.  Uses AuthSub
 * authentication and outputs a list of a user's albums if succesfully
 * authenticated.
 *
 * @return void
 */
function processPageLoad()
{
    global $_SESSION, $_GET;
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
        requestUserLogin('Please login to your Google Account.');
    } else {
        $client = getAuthSubHttpClient();
        if (!empty($_REQUEST['command'])) {
            switch ($_REQUEST['command']) {
                case 'retrieveSelf':
                    outputUserFeed($client, "default");
                    break;
                case 'retrieveUser':
                    outputUserFeed($client, $_REQUEST['user']);
                    break;
                case 'retrieveAlbumFeed':
                    outputAlbumFeed($client, $_REQUEST['user'], $_REQUEST['album']);
                    break;
                case 'retrievePhotoFeed':
                    outputPhotoFeed($client, $_REQUEST['user'], $_REQUEST['album'], $_REQUEST['photo']);
                    break;
            }
        }
        // Now we handle the potentially destructive commands, which have to
        // be submitted by POST only.
        if (!empty($_POST['command'])) {
            switch ($_POST['command']) {
                case 'addPhoto':
                    addPhoto($client, $_POST['user'], $_POST['album'], $_FILES['photo']);
                    break;
                case 'deletePhoto':
                    deletePhoto($client, $_POST['user'], $_POST['album'], $_POST['photo']);
                    break;
                case 'addAlbum':
                    addAlbum($client, $_POST['user'], $_POST['name']);
                    break;
                case 'deleteAlbum':
                    deleteAlbum($client, $_POST['user'], $_POST['album']);
                    break;
                case 'addComment':
                    addComment($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['comment']);
                    break;
                case 'addTag':
                    addTag($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['tag']);
                    break;
                case 'deleteComment':
                    deleteComment($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['comment']);
                    break;
                case 'deleteTag':
                    deleteTag($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['tag']);
                    break;
                default:
                    break;
            }
        }
        // If a menu parameter is available, display a submenu.
        if (!empty($_REQUEST['menu'])) {
            switch ($_REQUEST['menu']) {
                case 'user':
                    displayUserMenu();
                    break;
                case 'photo':
                    displayPhotoMenu();
                    break;
                case 'album':
                    displayAlbumMenu();
                    break;
                case 'logout':
                    logout();
                    break;
                default:
                    header('HTTP/1.1 400 Bad Request');
                    echo "<h2>Invalid menu selection.</h2>\n";
                    echo "<p>Please check your request and try again.</p>";
            }
        }
        if (empty($_REQUEST['menu']) && empty($_REQUEST['command'])) {
            displayMenu();
        }
    }
}
Пример #30
0
<?
  include_once('../database/eventFunc.php'); 
  

  try {
    $c = deleteComment($_POST['id']);
    if ($c === false){
      echo "fail";
    }
    else if ($c === true){
      echo "success";
    }
  } catch (PDOException $e) {
    die($e->getMessage());
  }
?>