本文整理汇总了PHP中Vote::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Vote::delete方法的具体用法?PHP Vote::delete怎么用?PHP Vote::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vote
的用法示例。
在下文中一共展示了Vote::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfVoteDelete
function wfVoteDelete($pageId)
{
global $wgUser;
if (!$wgUser->isAllowed('voteny')) {
return '';
}
if (is_numeric($pageId)) {
$vote = new Vote($pageId);
$vote->delete();
return $vote->count(1);
} else {
return 'error';
}
}
示例2: execute
function execute()
{
global $wgUser, $wgOut, $wgVoteDirectory, $wgCommentsDirectory, $IP;
require_once "{$wgVoteDirectory}/VoteClass.php";
require_once "{$wgVoteDirectory}/Publish.php";
require_once "{$wgVoteDirectory}/RSS.php";
require_once "{$wgCommentsDirectory}/CommentClass.php";
if ($_POST["mk"] == md5($_POST["pid"] . 'pants' . $wgUser->mName)) {
require_once "{$IP}/extensions/UserStats/UserStatsClass.php";
$stats = new UserStatsTrack(1, $wgUser->mId, $wgUser->mName);
if (($_GET["Action"] == 1 || $_GET["Action"] == 2) && is_numeric($_POST["pid"]) && (is_numeric($_POST["TheVote"]) || $_GET["Action"] == 2)) {
//echo 'test2';
$Vote = new Vote($_POST["pid"]);
$Vote->setUser($wgUser->mName, $wgUser->mId);
if ($_GET["Action"] == 1) {
$Vote->insert($_POST["TheVote"]);
$stats->incVoteCount();
} else {
$Vote->delete();
}
$CommentList = new Comment($_POST["pid"]);
$publish = new Publish();
$publish->PageID = $_POST["pid"];
$publish->VoteCount = $Vote->count(1);
$publish->CommentCount = $CommentList->count();
$publish->check_score();
echo $Vote->count(1);
}
if ($_GET["Action"] == 3) {
$Vote = new VoteStars($_POST["pid"]);
$Vote->setUser($wgUser->mName, $wgUser->mId);
$Vote->insert($_POST["TheVote"]);
$stats->incVoteCount();
echo $Vote->display();
}
if ($_GET["Action"] == 4) {
$Vote = new VoteStars($_POST["pid"]);
$Vote->setUser($wgUser->mName, $wgUser->mId);
$Vote->delete();
echo $Vote->display();
}
}
// This line removes the navigation and everything else from the
// page, if you don't set it, you get what looks like a regular wiki
// page, with the body you defined above.
$wgOut->setArticleBodyOnly(true);
}
示例3: ajax_delete
public function ajax_delete()
{
if (!$this->RequestHandler->isPost()) {
$this->error(ECode::$SYS_REQUESTERROR);
}
$this->requestLogin();
if (!isset($this->params['vid'])) {
$this->error("未知的投票");
}
$vid = intval($this->params['vid']);
try {
$vote = new Vote($vid);
} catch (VoteNullException $e) {
$this->error("未知的投票");
}
$u = User::getInstance();
if (!$u->isAdmin() && $u->userid != $vote->uid) {
$this->error("你无权删除此投票");
}
$vote->delete();
}
示例4: elseif
$votePoints = (int) $_GET['points'];
if (empty($videoID)) {
die;
}
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ip = md5($ip);
$dbh = new Database();
$sth = $dbh->prepare("SELECT * FROM " . DB_PREFIX . "votes WHERE video = ? AND ip = ?");
$sth->execute(array($videoID, $ip));
$result = $sth->fetchObject();
$vote = new Vote();
$vote->ip = $ip;
$vote->video = $videoID;
$vote->vote = $votePoints;
if (empty($result)) {
if ($votePoints == 1 || $votePoints == -1) {
$vote->create();
}
} else {
if ($votePoints == 1 || $votePoints == -1) {
$vote->save();
} elseif ($votePoints == 0) {
$vote->delete();
}
}
示例5: web_undo_vote
/**
* (Web service method) Undo vote for current track (for this nick)
* @param mixed[] $args nick
* @return mixed[] status; error_message; output (what to announce in IRC chat room)
*/
private function web_undo_vote($args)
{
$nick = $args['nick'];
$vote = Vote::get_undoable_vote($nick);
$opt = Options::get_instance();
if ($vote == NULL) {
$this->fail($nick . ': Can\'t delete last vote if it is over 10 minutes old.');
}
if ($vote->deleted == 1) {
$this->fail($nick . ': Your most recent vote has already been deleted.');
}
Vote::delete($vote->id);
Track::update_vote($vote->track_id);
$out = str_ireplace('${stream_title}', $vote->stream_title, $opt->txt_unvote_response);
$out = str_ireplace('${nick}', $nick, $out);
$out = str_ireplace('${value}', $num_txt, $out);
return array('status' => 'ok', 'error_message' => '', 'output' => $out, 'private' => $opt->txt_unvote_response_switch);
}