当前位置: 首页>>代码示例>>PHP>>正文


PHP Link::insert_vote方法代码示例

本文整理汇总了PHP中Link::insert_vote方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::insert_vote方法的具体用法?PHP Link::insert_vote怎么用?PHP Link::insert_vote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link::insert_vote方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Vote

 function insert_vote($user = 0, $value = 10)
 {
     if (parent::insert_vote($user, $value)) {
         $vote = new Vote();
         $vote->type = 'links';
         $vote->link = $this->id;
         if (Voting_Method == 2) {
             $this->votes = $vote->rating("!=0");
             $this->votecount = $vote->count("!=0");
             $this->reports = $this->count_all_votes("<0");
         } else {
             $this->reports = $this->count_all_votes("<0");
             $this->votes = $vote->count() - $this->reports;
         }
         $this->store_basic();
         $this->check_should_publish();
         $vars = array('vote' => $this);
         check_actions('link_insert_vote_post', $vars);
         return true;
     }
     return false;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:22,代码来源:vote_total.php

示例2: sanitize

 	}
 
 	if($link->votes($current_user->user_id) > 0 || $link->reports($current_user->user_id) > 0) {
 	}
 */
 $value = sanitize($_POST['value'], 3);
 /*	if(sanitize($_POST['unvote'], 3) == 'true'){
 		$link->remove_vote($current_user->user_id, $value);
 	} else {
 	if($link->votes($current_user->user_id) > 0 || $link->reports($current_user->user_id) > 0 ||
 	   // DB 11/10/08
 	   (votes_per_ip > 0 && $link->votes_from_ip() + $link->reports_from_ip() >= votes_per_ip)) {
 	   /////
 		error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted'));
 	}*/
 $link->insert_vote($current_user->user_id, $value);
 //	}
 /*	if ($link->status == 'discard') {
 	$link->read();
 	$link->status = 'queued';
 	$link->store();
 	}
 */
 if (Voting_Method == 2) {
     $link_rating = $link->rating($link->id) / 2;
     $rating_width = $link_rating * 25;
     $vote_count = $link->countvotes();
     echo $rating_width . "~" . $link_rating . "~" . $vote_count;
 }
 /*	else
 	{
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:31,代码来源:vote.php

示例3: do_submit3

function do_submit3()
{
    global $db, $current_user;
    $linkres = new Link();
    $linkres->id = $link_id = intval($_POST['id']);
    $linkres->read();
    // Check it is not in the queue already
    if ($linkres->votes == 0 && $linkres->status != 'queued') {
        $linkres->status = 'queued';
        $linkres->date = time();
        $linkres->get_uri();
        $linkres->store();
        $linkres->insert_vote($current_user->user_id, $current_user->user_karma);
        // Add the new link log/event
        require_once mnminclude . 'log.php';
        log_conditional_insert('link_new', $linkres->id, $linkres->author);
        $db->query("delete from links where link_author = {$linkres->author} and link_status='discard' and link_votes=0");
        if (!empty($_POST['trackback'])) {
            require_once mnminclude . 'trackback.php';
            $trackres = new Trackback();
            $trackres->url = clean_input_url($_POST['trackback']);
            $trackres->link = $linkres->id;
            $trackres->title = $linkres->title;
            $trackres->author = $linkres->author;
            $trackres->content = $linkres->content;
            $res = $trackres->send($linkres);
        }
    }
    header("Location: shakeit.php");
    die;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:submit.php

示例4: error

        $user->read();
        $user->karma = $user->karma - 0.2;
        $user->store();
        $annotation = new Annotation("karma-{$user->id}");
        $annotation->append(_('voto cowboy') . ": -0.2, karma: {$user->karma}\n");
        error(_('¡tranquilo cowboy!') . ', ' . _('tu karma ha bajado: ') . $user->karma);
    } else {
        error(_('¡tranquilo cowboy!'));
    }
}
if ($current_user->user_id > 0) {
    $value = $current_user->user_karma;
} else {
    $value = $anon_karma;
}
if (!$link->insert_vote($value)) {
    if ($current_user->user_id > 0) {
        error(_('ya se votó antes con el mismo usuario o IP'));
    } else {
        error(_('ya se votó antes desde la misma IP'));
    }
}
if ($link->status == 'discard' && $current_user->user_id > 0 && $link->votes > $link->negatives && $link->karma > 0) {
    $link->status = 'queued';
    $link->store_basic();
}
echo $link->json_votes_info(intval($value));
function error($mess)
{
    $dict['error'] = $mess;
    echo json_encode($dict);
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:menealo.php

示例5: do_submit3

function do_submit3() {
	global $db, $current_user;

	$linkres=new Link;

	$linkres->id=$link_id = intval($_POST['id']);
	$linkres->read();
	// Check it is not in the queue already
	if($linkres->votes == 0 && $linkres->status != 'queued') {
		$linkres->status='queued';
		$linkres->date=time();
		$linkres->store_basic();
		$linkres->insert_vote($current_user->user_id);
		$db->query("delete from links where link_author = $linkres->author and link_status='discard' and link_votes=0");
		if(!empty($_POST['trackback'])) {
			require_once(mnminclude.'trackback.php');
			$trackres = new Trackback;
			$trackres->url=preg_replace('/ /', '+', trim($_POST['trackback']));
			$trackres->link=$linkres->id;
			$trackres->title=$linkres->title;
			$trackres->author=$linkres->author;
			$trackres->content=$linkres->content;
			$res = $trackres->send();
		}
	}

	header("Location: ./shakeit.php");
	die;
	
}
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:30,代码来源:submit.php

示例6: do_submit3

function do_submit3() {
	global $db, $current_user;

	$linkres=new Link;

	$linkres->id=$link_id = intval($_POST['id']);

	if(!check_link_key() || !$linkres->read()) die;

	// Check it is not in the queue already
	if ($linkres->duplicates($linkres->url)) {
		// Write headers, they were not printed yet
		do_header(_("enviar noticia"), "post");
		echo '<div id="singlewrap">' . "\n";
		report_dupe($linkres->url);
		return;
	}

	// Check this one was not already queued
	if($linkres->votes == 0 && $linkres->status != 'queued') {
		$db->transaction();
		$linkres->status='queued';
		$linkres->sent_date = $linkres->date=time();
		$linkres->get_uri();
		$linkres->store();
		$linkres->insert_vote($current_user->user_karma);
		$db->commit();

		// Add the new link log/event
		require_once(mnminclude.'log.php');
		log_conditional_insert('link_new', $linkres->id, $linkres->author);

		$db->query("delete from links where link_author = $linkres->author and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0");
		if(!empty($_POST['trackback'])) {
			$trackres = new Trackback;
			$trackres->url=clean_input_url($_POST['trackback']);
			$trackres->link_id=$linkres->id;
			$trackres->link=$linkres->url;
			$trackres->author=$linkres->author;
			$trackres->status = 'pendent';
			$trackres->store();
		}
		fork("backend/send_pingbacks.php?id=$linkres->id");
	}

	header('Location: '. $linkres->get_permalink());
	die;
	
}
开发者ID:rasomu,项目名称:chuza,代码行数:49,代码来源:submit.php

示例7: do_submit2

function do_submit2()
{
    global $db, $main_smarty, $dblang, $the_template, $linkres, $current_user, $Story_Content_Tags_To_Allow;
    $main_smarty->assign('auto_vote', auto_vote);
    $main_smarty->assign('Submit_Show_URL_Input', Submit_Show_URL_Input);
    $main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL);
    $main_smarty->assign('link_id', sanitize($_POST['id'], 3));
    define('pagename', 'submit');
    $main_smarty->assign('pagename', pagename);
    if ($current_user->authenticated != TRUE) {
        $vars = array('username' => $current_user->user_login);
        check_actions('register_check_errors', $vars);
    }
    check_actions('submit2_check_errors', $vars);
    if ($vars['error'] == true) {
        // No action
    }
    $linkres = new Link();
    $linkres->id = sanitize($_POST['id'], 3);
    if ($_SESSION['step'] != 1) {
        die('Wrong step');
    }
    if (!is_numeric($linkres->id)) {
        die;
    }
    if (!$linkres->verify_ownership($current_user->user_id)) {
        die($main_smarty->get_config_vars('PLIGG_Visual_Submit2Errors_NoAccess'));
    }
    $linkres->read(FALSE);
    if ($linkres->votes($current_user->user_id) == 0 && auto_vote == true) {
        $linkres->insert_vote($current_user->user_id, '10');
        $linkres->store_basic();
        $linkres->read(FALSE);
    }
    if (is_array($_POST['category'])) {
        $linkres->category = sanitize($_POST['category'][0], 3);
        $linkres->additional_cats = array_slice($_POST['category'], 1);
    } else {
        $linkres->category = sanitize($_POST['category'], 3);
    }
    $thecat = get_cached_category_data('category_id', $linkres->category);
    $main_smarty->assign('request_category_name', $thecat->category_name);
    $linkres->title = stripslashes(sanitize($_POST['title'], 3));
    $linkres->title_url = makeUrlFriendly($linkres->title, $linkres->id);
    $linkres->tags = tags_normalize_string(stripslashes(sanitize($_POST['tags'], 3)));
    $linkres->content = close_tags(stripslashes(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow)));
    //$linkres->content = str_replace("\n", "<br />", $linkres->content);
    if (isset($_POST['link_field1'])) {
        $linkres->link_field1 = sanitize($_POST['link_field1'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field2'])) {
        $linkres->link_field2 = sanitize($_POST['link_field2'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field3'])) {
        $linkres->link_field3 = sanitize($_POST['link_field3'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field4'])) {
        $linkres->link_field4 = sanitize($_POST['link_field4'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field5'])) {
        $linkres->link_field5 = sanitize($_POST['link_field5'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field6'])) {
        $linkres->link_field6 = sanitize($_POST['link_field6'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field7'])) {
        $linkres->link_field7 = sanitize($_POST['link_field7'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field8'])) {
        $linkres->link_field8 = sanitize($_POST['link_field8'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field9'])) {
        $linkres->link_field9 = sanitize($_POST['link_field9'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field10'])) {
        $linkres->link_field10 = sanitize($_POST['link_field10'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field11'])) {
        $linkres->link_field11 = sanitize($_POST['link_field11'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field12'])) {
        $linkres->link_field12 = sanitize($_POST['link_field12'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field13'])) {
        $linkres->link_field13 = sanitize($_POST['link_field13'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field14'])) {
        $linkres->link_field14 = sanitize($_POST['link_field14'], 4, $Story_Content_Tags_To_Allow);
    }
    if (isset($_POST['link_field15'])) {
        $linkres->link_field15 = sanitize($_POST['link_field15'], 4, $Story_Content_Tags_To_Allow);
    }
    if (!isset($_POST['summarytext'])) {
        $linkres->link_summary = utf8_substr(sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow), 0, StorySummary_ContentTruncate - 1);
        //$linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
    } else {
        $linkres->link_summary = sanitize($_POST['summarytext'], 4, $Story_Content_Tags_To_Allow);
        //$linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
        if (utf8_strlen($linkres->link_summary) > StorySummary_ContentTruncate) {
            loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: ' . sanitize($_POST["username"], 3) . '|email: ' . sanitize($_POST["email"], 3), true);
//.........这里部分代码省略.........
开发者ID:bendroid,项目名称:pligg-cms,代码行数:101,代码来源:submit.php

示例8: do_submit3

function do_submit3()
{
    global $db, $current_user;
    $linkres = new Link();
    $linkres->id = $link_id = intval($_POST['id']);
    if (!check_link_key() || !$linkres->read()) {
        die;
    }
    // Check it is not in the queue already
    if ($linkres->votes == 0 && $linkres->status != 'queued') {
        $linkres->status = 'queued';
        $linkres->sent_date = $linkres->date = time();
        $linkres->get_uri();
        $linkres->store();
        $linkres->insert_vote($current_user->user_id, $current_user->user_karma);
        // Add the new link log/event
        require_once mnminclude . 'log.php';
        log_conditional_insert('link_new', $linkres->id, $linkres->author);
        $db->query("delete from links where link_author = {$linkres->author} and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0");
        if (!empty($_POST['trackback'])) {
            require_once mnminclude . 'trackback.php';
            $trackres = new Trackback();
            $trackres->url = clean_input_url($_POST['trackback']);
            $trackres->link_id = $linkres->id;
            $trackres->link = $linkres->url;
            //$trackres->title=$linkres->title;
            $trackres->author = $linkres->author;
            //$trackres->content=$linkres->content;
            $res = $trackres->send($linkres);
        }
        fork("backend/send_pingbacks.php?id={$linkres->id}");
    }
    header('Location: ' . $linkres->get_permalink());
    die;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:35,代码来源:submit.php

示例9: Link

	';
?>



	<?php 
global $db, $main_smarty, $dblang, $the_template, $linkres, $current_user;
$linkres = new Link();
$linkres->id = $link_id = $_POST['id'];
if (!is_numeric($link_id)) {
    die;
}
$linkres->read(FALSE);
$linkres->related_category = $_POST['category_related'];
if ($linkres->votes($current_user->user_id) == 0 && auto_vote == true) {
    $linkres->insert_vote($current_user->user_id, '10');
    $linkres->store_basic();
    $linkres->read(FALSE);
}
if (checklevel('god')) {
    $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_God;
} elseif (checklevel('admin')) {
    $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Admin;
} else {
    $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Normal;
}
$linkres->category = strip_tags($_POST['category']);
$linkres->title = strip_tags(trim($_POST['title']));
$linkres->title_url = makeUrlFriendly($linkres->title);
$linkres->tags = tags_normalize_string(strip_tags(trim($_POST['tags'])));
$linkres->content = strip_tags(trim($_POST['bodytext']), $Story_Content_Tags_To_Allow);
开发者ID:pantofla,项目名称:geez,代码行数:31,代码来源:c_df3150615c348b1ebb17e087f15662a5.php


注:本文中的Link::insert_vote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。