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


PHP Link::store方法代码示例

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


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

示例1: store

 function store()
 {
     // save the comment to the database
     global $db, $current_user, $the_template;
     if (!$this->date) {
         $this->date = time();
     }
     $comment_id = $this->id;
     if (!is_numeric($comment_id)) {
         return false;
     }
     $comment_author = $this->author;
     $comment_link = $this->link;
     $comment_karma = $this->karma;
     $comment_date = $this->date;
     $comment_randkey = $this->randkey;
     $comment_content = $db->escape($this->content);
     $comment_votes = $this->votes;
     $comment_parent = $this->parent;
     if ($this->id === 0) {
         $this->canSave = true;
         // assume we can save
         $vars = array('comment' => &$this);
         check_actions('comment_save', $vars);
         if ($this->canSave == true) {
             // if this is a new comment
             $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id, comment_karma, comment_date, comment_randkey, comment_content) VALUES ({$comment_parent}, {$comment_author}, {$comment_link}, {$comment_karma}, FROM_UNIXTIME({$comment_date}), {$comment_randkey}, '{$comment_content}')";
             $db->query($sql);
             $this->id = $db->insert_id;
             $link = new Link();
             $link->id = $this->link;
             $link->read();
             $link->adjust_comment(1);
             $link->store();
             $link = '';
             $vars = array('comment' => &$this);
             check_actions('comment_post_save', $vars);
         }
     } else {
         // if we're editing an existing comment
         $sql = "UPDATE " . table_comments . " set comment_votes={$comment_votes}, comment_user_id={$comment_author}, comment_link_id={$comment_link}, comment_karma={$comment_karma}, comment_date=FROM_UNIXTIME({$comment_date}), comment_randkey={$comment_randkey}, comment_content='{$comment_content}' WHERE comment_id={$comment_id}";
         $db->query($sql);
     }
     $vars = array('comment' => $this);
     check_actions('comment_store_post_sql', $vars);
 }
开发者ID:pantofla,项目名称:waterfan,代码行数:46,代码来源:comment.php

示例2: insert_anonymous_comment

function insert_anonymous_comment(&$vars)
{
    global $db;
    $link_id = $vars['link_id'];
    $user_id = $vars['user_id'];
    $randkey = $vars['randkey'];
    $comment_content = $vars['comment_content'];
    $a_username = $vars['a_username'];
    $a_email = $vars['a_email'];
    $a_website = $vars['a_website'];
    $sql = "INSERT INTO " . table_comments . " (comment_user_id, comment_link_id, comment_date, comment_randkey, comment_content,`comment_anonymous_username`, `comment_anonymous_email`, `comment_anonymous_website` ) VALUES ({$user_id}, {$link_id}, NOW(), {$randkey}, '{$comment_content}', '{$a_username}','{$a_email}', '{$a_website}')";
    $result = $db->query($sql);
    // DB 12/17/08
    $link = new Link();
    $link->id = $link_id;
    $link->read();
    $link->adjust_comment(1);
    $link->store();
    /////
}
开发者ID:pantofla,项目名称:waterfan,代码行数:20,代码来源:anonymous_comments_main.php

示例3: delete_comment

function delete_comment($key)
{
    global $db;
    if (!is_numeric($key)) {
        return;
    }
    $link_id = $db->get_var("SELECT comment_link_id FROM `" . table_comments . "` WHERE `comment_id` = " . $key . ";");
    $vars = array('comment_id' => $key);
    check_actions('comment_deleted', $vars);
    $comments = $db->get_results($sql = "SELECT comment_id FROM " . table_comments . " WHERE `comment_parent` = '{$key}'");
    foreach ($comments as $comment) {
        $vars = array('comment_id' => $comment->comment_id);
        check_actions('comment_deleted', $vars);
    }
    $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_parent` = "' . $key . '"');
    $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_id` = "' . $key . '"');
    $link = new Link();
    $link->id = $link_id;
    $link->read();
    $link->recalc_comments();
    $link->store();
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:22,代码来源:admin_delete_comments.php

示例4: do_submit1

function do_submit1() {
	global $db, $dblang, $current_user;

	do_navbar(_('enviar noticia ') . '»'. _(' paso 2: detalles'));
	echo '<div id="genericform-contents">'."\n";

	// avoid spams, an extra security check
	$from = time() - 3600;
	$same_user = $db->get_var("select count(*) from links where link_date > from_unixtime($from) and link_author=$current_user->user_id");
	if ($same_user > 4) {
		echo '<p class="error"><strong>'._('debes esperar').  '</strong></p>';
		echo '<br style="clear: both;" />' . "\n";
		echo '</div>'. "\n";
		return;
	}
	
	$url = trim(preg_replace('/ /', '+', $_POST['url']));
	$linkres=new Link;

	$edit = false;
	$linkres->get($url);
	$trackback=$linkres->trackback;
	$linkres->randkey = intval($_POST['randkey']);
	if(!$linkres->valid) {
		echo '<p class="error"><strong>'._('url no válido').':</strong> ('.$url.')</p>';
		echo '<p>'._('prueba con otra dirección').'</p>';
		print_empty_submit_form();
		return;
	}

	// avoid auto-promotion (autobombo)
	$hours = 4;
	$from = time() - 3600*$hours;
	$same_blog = $db->get_var("select count(*) from links where link_date > from_unixtime($from) and link_author=$current_user->user_id and link_blog=$linkres->blog and link_votes > 0");
	if ($same_blog > 0 && $current_user->user_karma < 12) {
		echo '<p class="error"><strong>'._('ya has enviado un enlace al mismo sitio hace poco tiempo').'</strong></p> ';
		echo '<p class="error-text">'._('debes esperar'). " $hours " . _(' horas entre cada envío al mismo sitio. Es para evitar "spams" y "autobombo"') . ', ';
		echo '<a href="faq-'.$dblang.'.php">'._('lee el FAQ').'</a></p>';
		echo '<br style="clear: both;" />' . "\n";
		echo '</div>'. "\n";
		return;
	}
	
	// check that the user also votes, not only sends links
	if ($current_user->user_karma < 10) {
		$from = time() - 3600*24;
		$user_votes = $db->get_var("select count(*) from votes where vote_type='links' and vote_date > from_unixtime($from) and vote_user_id=$current_user->user_id");
		$user_links = 1 + $db->get_var("select count(*) from links where link_author=$current_user->user_id and link_date > from_unixtime($from) and link_status != 'discard'");
		$total_links = $db->get_var("select count(*) from links where  link_date > from_unixtime($from) and link_status = 'queued'");
		$min_votes = intval($total_links/20) * $user_links;
		if ($user_votes < $min_votes) {
			$needed = $min_votes - $user_votes;
			echo '<p class="error"><strong>'._('no tienes el mínimo de votos necesarios para enviar una nueva historia').'</strong></p> ';
			echo '<p class="error-text">'._('necesitas votar como mínimo a'). " $needed " . _('noticias') . ', ';
			echo '<a href="shakeit.php" target="_blank">'._('haz clic aquí para ir a votar').'</a></p>';
			echo '<br style="clear: both;" />' . "\n";
			echo '</div>'. "\n";
			return;
		}
	}
	
	if($linkres->duplicates($url) > 0) {
		echo '<p class="error"><strong>'._('noticia repetida!').'</strong></p> ';
		echo '<p class="error-text">'._('lo sentimos').'</p>';
		echo '<p class="error-text"><a href="index.php?search='.htmlentities($url).'">'._('haz clic aquí para votar o comentar la noticia que enviaron antes').'</a>';
		echo '<br style="clear: both;" /><br style="clear: both;" />' . "\n";
		echo '<form id="genericform">';
		echo '<input class="genericsubmit" type=button onclick="window.history.go(-1)" value="'._('&#171; retroceder').'" />';
		echo '</form>'. "\n";
		echo '</div>'. "\n";
		return;
	}
	$linkres->status='discard';
	$linkres->author=$current_user->user_id;

	/***** Currently commented out until we find if it makes sense here
	// First delete last drafts, just in case to avoid triggering the anti spam measure
	$from = time() - 1800;
	$db->query("delete from links where link_date > from_unixtime($from) and link_author=$current_user->user_id and link_status='discard' and link_votes = 0");
	*****/

	// Now stores new draft
	$linkres->store();
	
	echo '<h2>'._('envío de una nueva noticia: paso 2 de 3').'</h2>'."\n";


	echo '<div id="genericform">'."\n";
	echo '<form action="/submit.php" method="post" id="thisform">'."\n";

	echo '<input type="hidden" name="url" id="url" value="'.$url.'" />'."\n";
	echo '<input type="hidden" name="phase" value="2" />'."\n";
	echo '<input type="hidden" name="randkey" value="'.intval($_POST['randkey']).'" />'."\n";
	echo '<input type="hidden" name="id" value="'.$linkres->id.'" />'."\n";

	echo '<fieldset><legend><span class="sign">'._('info de la noticia').'</span></legend>'."\n";
	echo '<p class="genericformtxt"><label for="url_title" accesskey="1">'._('título de la página').': </label> '."\n";
	echo $linkres->url_title;
	if($linkres->type() === 'blog') {
		echo '<br /> ('._('parece ser un blog').')</p>'."\n";
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:101,代码来源:submit.php

示例5: do_submit1

function do_submit1()
{
    global $db, $main_smarty, $dblang, $the_template, $linkres, $current_user, $Story_Content_Tags_To_Allow;
    $linkres = new Link();
    $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);
    $linkres->store();
    $linkres->id = sanitize($_POST['id'], 3);
    $thecat = get_cached_category_data('category_id', $linkres->category);
    $main_smarty->assign('request_category_name', $thecat->category_name);
    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);
            $linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
            $linkres->link_summary = close_tags(str_replace("\n", "<br />", $linkres->link_summary));
        }
    }
    $sid = $_POST["sid"];
    tags_insert_string($sid, $dblang, $linkres->tags);
    //$main_smarty->assign('the_story', $linkres->print_summary('full', true));
    $main_smarty->assign('tags', $linkres->tags);
    if (!empty($linkres->tags)) {
        $tags_words = str_replace(",", ", ", $linkres->tags);
        $tags_url = urlencode($linkres->tags);
        $main_smarty->assign('tags_words', $tags_words);
        $main_smarty->assign('tags_url', $tags_url);
    }
    $main_smarty->assign('submit_url_title', $linkres->url_title);
    $main_smarty->assign('submit_id', $linkres->id);
    $main_smarty->assign('submit_title', str_replace('"', "&#034;", $link_title));
    $main_smarty->assign('submit_content', $link_content);
    include mnminclude . 'redirector.php';
    $x = new redirector($_SERVER['REQUEST_URI']);
    //$Sid=$_SESSION['newSid'];
    header("Location:" . my_base_url . my_pligg_base . "/story.php?title={$sid}");
    $vars = '';
    check_actions('do_submit2', $vars);
    $_SESSION['step'] = 2;
    $main_smarty->display($the_template . '/pligg.tpl');
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:49,代码来源:submit1.php

示例6: 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);
		$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($linkres);
		}
	}

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

示例7: akismet_showpage


//.........这里部分代码省略.........
            if (count($spam_links) > 0) {
                $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE ";
                $sql .= 'link_id IN (' . implode(',', $spam_links) . ')';
                $link_data = $db->get_results($sql);
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header('Location: ' . URL_akismet);
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSettings') {
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        /*
        if($view == 'isSpam'){
        	if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';}
        
        	$spam_links = get_misc_data('spam_links');
        	$spam_links = unserialize(get_misc_data('spam_links'));
        
        	unset($spam_links[$link_id]);
        	misc_data_update('spam_links', serialize($spam_links));
        
        	$link = new Link;
        	$link->id = $link_id;
        	$link->read(FALSE);
        	$link->status = 'discard';
        	$link->store();
        
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        
        if($view == 'isNotSpam'){
        	if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';}
        
        	$spam_links = get_misc_data('spam_links');
        	$spam_links = unserialize(get_misc_data('spam_links'));
        
        	unset($spam_links[$link_id]);
        	misc_data_update('spam_links', serialize($spam_links));
        
        	$link = new Link;
        	$link->id = $link_id;
        	$link->read(FALSE);
        	$link->status = 'queued';
        	$link->store();
        
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        
        if($view == 'addSpam'){
        
        	$spam_links[1] = 1;
        	misc_data_update('spam_links', serialize($spam_links));
        	header('Location: ' . URL_akismet . '&view=manageSpam');
        
        }
        */
        if ($view == 'manageSpamcomments') {
            $spam_comments = get_misc_data('spam_comments');
开发者ID:pantofla,项目名称:waterfan,代码行数:67,代码来源:akismet_main.php

示例8: spam_trigger_killspam

function spam_trigger_killspam($id)
{
    global $db, $current_user;
    #	include_once(mnminclude.'link.php');
    #	include_once(mnminclude.'votes.php');
    $oldlevel = $current_user->user_level;
    $current_user->user_level = 'admin';
    killspam($id);
    $current_user->user_level = $oldlevel;
    return;
    $db->query('UPDATE `' . table_users . "` SET user_enabled=0, `user_pass` = '63205e60098a9758101eeff9df0912ccaaca6fca3e50cdce3', user_level='Spammer' WHERE `user_id` = {$id}");
    $db->query('UPDATE `' . table_links . '` SET `link_status` = "discard" WHERE `link_author` = "' . $id . '"');
    $results = $db->get_results("SELECT comment_id, comment_link_id FROM `" . table_comments . "` WHERE `comment_user_id` = {$id}");
    if ($results) {
        foreach ($results as $result) {
            $comment_id = $result->comment_id;
            $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_id` = "' . $comment_id . '"');
            $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_parent` = "' . $comment_id . '"');
            $link = new Link();
            $link->id = $result->comment_link_id;
            $link->read();
            $link->recalc_comments();
            $link->store();
        }
    }
    $results = $db->get_results("SELECT vote_id,vote_link_id FROM `" . table_votes . "` WHERE `vote_user_id` = {$id}");
    if ($results) {
        foreach ($results as $result) {
            $db->query('DELETE FROM `' . table_votes . '` WHERE `vote_id` = "' . $result->vote_id . '"');
            $link = new Link();
            $link->id = $result->vote_link_id;
            $link->read();
            $vote = new Vote();
            $vote->type = 'links';
            $vote->link = $result->vote_link_id;
            if (Voting_Method == 1) {
                $link->votes = $vote->count();
                $link->reports = $link->count_all_votes("<0");
            } elseif (Voting_Method == 2) {
                $link->votes = $vote->rating();
                $link->votecount = $vote->count();
                $link->reports = $link->count_all_votes("<0");
            }
            $link->store_basic();
            $link->check_should_publish();
        }
    }
    $db->query('DELETE FROM `' . table_saved_links . '` WHERE `saved_user_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_trackbacks . '` WHERE `trackback_user_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_friends . '` WHERE `friend_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_messages . "` WHERE `sender`={$id} OR `receiver`={$id}");
}
开发者ID:bendroid,项目名称:pligg-cms,代码行数:52,代码来源:spam_trigger_main.php

示例9: killspam

function killspam($id)
{
    global $db;
    require_once mnminclude . 'link.php';
    require_once mnminclude . 'votes.php';
    require_once mnminclude . 'tags.php';
    $user = $db->get_row('SELECT * FROM ' . table_users . " where user_id={$id}");
    if (!$user->user_id) {
        return;
    }
    canIChangeUser($user->user_level);
    $db->query('UPDATE `' . table_users . "` SET user_enabled=0, `user_pass` = '63205e60098a9758101eeff9df0912ccaaca6fca3e50cdce3', user_level = 'Spammer' WHERE `user_id` = {$id}");
    $results = $db->get_results($sql = "SELECT comment_id, comment_link_id FROM `" . table_comments . "` WHERE `comment_user_id` = {$id}");
    if ($results) {
        foreach ($results as $result) {
            $db->query($sql = 'UPDATE `' . table_comments . '` SET `comment_status` = "spam" WHERE `comment_id` = "' . $result->comment_id . '"');
            $vars = array('comment_id' => $result->comment_id);
            check_actions('comment_spam', $vars);
            $link = new Link();
            $link->id = $result->comment_link_id;
            $link->read();
            $link->recalc_comments();
            $link->store();
        }
    }
    ban_ip($user->user_ip, $user->user_lastip);
    $results = $db->get_results("SELECT * FROM `" . table_groups . "` WHERE group_creator = '{$id}'");
    if ($results) {
        foreach ($results as $result) {
            $db->query('DELETE FROM `' . table_group_member . '` WHERE member_group_id = ' . $result->group_id);
            $db->query('DELETE FROM `' . table_group_shared . '` WHERE share_group_id = ' . $result->group_id);
        }
    }
    $db->query("DELETE FROM `" . table_groups . "` WHERE group_creator = '{$id}'");
    $results = $db->get_results("SELECT vote_id,vote_link_id FROM `" . table_votes . "` WHERE `vote_user_id` = {$id}");
    if ($results) {
        foreach ($results as $result) {
            $db->query('DELETE FROM `' . table_votes . '` WHERE `vote_id` = "' . $result->vote_id . '"');
            $link = new Link();
            $link->id = $result->vote_link_id;
            $link->read();
            $vote = new Vote();
            $vote->type = 'links';
            $vote->link = $result->vote_link_id;
            if (Voting_Method == 1) {
                $link->votes = $vote->count();
                $link->reports = $link->count_all_votes("<0");
            } elseif (Voting_Method == 2) {
                $link->votes = $vote->rating();
                $link->votecount = $vote->count();
                $link->reports = $link->count_all_votes("<0");
            } elseif (Voting_Method == 3) {
                $link->votes = $vote->count();
                $link->karma = $vote->karma();
                $link->reports = $link->count_all_votes("<0");
            }
            $link->store_basic();
            $link->check_should_publish();
        }
    }
    $results = $db->get_results($sql = "SELECT link_id, link_url FROM `" . table_links . "` WHERE `link_author` = {$id}");
    global $USER_SPAM_RULESET, $FRIENDLY_DOMAINS;
    $filename = mnmpath . $USER_SPAM_RULESET;
    $lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    $approved = file(mnmpath . $FRIENDLY_DOMAINS, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    if ($results) {
        foreach ($results as $result) {
            if (preg_match('/:\\/\\/(www\\.)?([^\\/]+)(\\/|$)/', $result->link_url, $m)) {
                $domain = strtoupper($m[2]) . "\n";
                if (!in_array($domain, $lines) && !in_array($domain, $approved)) {
                    $lines[] = $domain;
                    $changed = 1;
                }
            }
            $vars = array('link_id' => $result->link_id);
            check_actions('story_spam', $vars);
        }
    }
    if ($changed) {
        if (is_writable($filename)) {
            if ($handle = fopen($filename, 'w')) {
                fwrite($handle, join("\n", $lines));
                fclose($handle);
            }
        }
    }
    $db->query($sql = 'UPDATE `' . table_links . '` SET `link_status` = "spam" WHERE `link_author` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_saved_links . '` WHERE `saved_user_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_trackbacks . '` WHERE `trackback_user_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_friends . '` WHERE `friend_id` = "' . $id . '"');
    $db->query('DELETE FROM `' . table_messages . "` WHERE `sender`={$id} OR `receiver`={$id}");
}
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:92,代码来源:user.php

示例10: do_the_import_stuff


//.........这里部分代码省略.........
                // strip all except letters and spaces and commas
                $linkres->tags = preg_replace('/[^a-z A-Z,]+/i', '', $temp1);
            }
            //----------------------------------------------------------------------
            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->title_url = makeUrlFriendly($linkres->title);
            $linkres->url = get_val($item, $MyArray['link_url']);
            $linkres->url_title = $linkres->title;
            $linkres->content = get_val($item, $MyArray['content']);
            $linkres->content = strip_tags($linkres->content, $Story_Content_Tags_To_Allow);
            $linkres->content = str_replace("\n", "<br />", $linkres->content);
            $linkres->link_field1 = get_val($item, $MyArray['link_field1']);
            $linkres->link_field2 = get_val($item, $MyArray['link_field2']);
            $linkres->link_field3 = get_val($item, $MyArray['link_field3']);
            $linkres->link_field4 = get_val($item, $MyArray['link_field4']);
            $linkres->link_field5 = get_val($item, $MyArray['link_field5']);
            $linkres->link_field6 = get_val($item, $MyArray['link_field6']);
            $linkres->link_field7 = get_val($item, $MyArray['link_field7']);
            $linkres->link_field8 = get_val($item, $MyArray['link_field8']);
            $linkres->link_field9 = get_val($item, $MyArray['link_field9']);
            $linkres->link_field10 = get_val($item, $MyArray['link_field10']);
            $linkres->link_field11 = get_val($item, $MyArray['link_field11']);
            $linkres->link_field12 = get_val($item, $MyArray['link_field12']);
            $linkres->link_field13 = get_val($item, $MyArray['link_field13']);
            $linkres->link_field14 = get_val($item, $MyArray['link_field14']);
            $linkres->link_field15 = get_val($item, $MyArray['link_field15']);
            $linkres->category = $feed->feed_category;
            //MJE: MOD
            $linkres->link_summary = utf8_substr(strip_tags($linkres->content), 0, StorySummary_ContentTruncate - 1);
            //---------
            if ($thecount >= $feed->feed_item_limit && $skipthis == 0) {
                echo "Reached import limit, skipping<HR>";
                $skipthis = 1;
            }
            if ($feed->feed_title_dupe == 0 && $skipthis == 0) {
                // 0 means don't allow, 1 means allow
                if ($linkres->duplicates_title($linkres->title) > 0) {
                    //echo "Title Match, skipping: " . $linkres->title . "<HR>";
                    echo '<span style="color:#fc0000;">Title Match, skipping</span> <hr>';
                    $skipthis = 1;
                }
            }
            if ($feed->feed_url_dupe == 0 && $linkres->url != "" && $skipthis == 0) {
                // 0 means don't allow, 1 means allow
                if ($linkres->duplicates($linkres->url) > 0) {
                    //echo "URL Match, skipping: " . $linkres->title . "<HR>";
                    echo '<span style="color:#fc0000;">URL Match, skipping</span> <hr>';
                    $skipthis = 1;
                }
            }
            if ($skipthis == 0) {
                echo "Importing <hr>";
                $added_one = true;
                $linkres->store();
                totals_adjust_count($linkres->status, 1);
                tags_insert_string($linkres->id, $dblang, $linkres->tags);
                require_once mnminclude . 'votes.php';
                if ($feed->feed_random_vote_enable == 1) {
                    $feed->feed_votes = rand($feed->feed_random_vote_min, $feed->feed_random_vote_max);
                }
                $votes = 0;
                for ($i = 1; $i <= $feed->feed_votes; $i++) {
                    $value = 1;
                    $vote = new Vote();
                    $vote->type = 'links';
                    $vote->user = 0;
                    $vote->link = $linkres->id;
                    $vote->ip = '0.0.0.' . $i;
                    $vote->value = $value;
                    $vote->insert();
                    $vote = "";
                    $votes += $value;
                    //								$vote = new Vote;
                    //								$vote->type='links';
                    //								$vote->link=$linkres->id;
                }
                $linkres->votes = $votes;
                $linkres->store_basic();
                $linkres->check_should_publish();
                $thecount = $thecount + 1;
            }
        }
        $sql = "UPDATE `" . table_feeds . "` SET `feed_last_check` = FROM_UNIXTIME(" . (time() - 300) . ") WHERE `feed_id` = {$feed->feed_id};";
        //echo $sql;
        $db->query($sql);
    } else {
        echo "Feed not fully setup, skipping <hr>";
    }
    if ($added_one) {
        return true;
    } else {
        return false;
    }
}
开发者ID:pantofla,项目名称:geez,代码行数:101,代码来源:c_2b4458b72e68ab6a5b376f81507a1134.php

示例11: Vote

     // 0 means don't allow, 1 means allow
     if ($linkres->duplicates_title($linkres->title) > 0) {
         echo "Title Match, skipping: " . $linkres->title . "<HR>";
         $skipthis = 1;
     }
 }
 if ($feed->feed_url_dupe == 0 && $linkres->url != "" && $skipthis == 0) {
     // 0 means don't allow, 1 means allow
     if ($linkres->duplicates($linkres->url) > 0) {
         echo "URL Match, skipping: " . $linkres->title . "<HR>";
         $skipthis = 1;
     }
 }
 if ($skipthis == 0) {
     echo "Importing <hr>";
     $linkres->store();
     tags_insert_string($linkres->id, $dblang, $linkres->tags);
     require_once mnminclude . 'votes.php';
     for ($i = 1; $i <= $feed->feed_votes; $i++) {
         $value = 10;
         $vote = new Vote();
         $vote->type = 'links';
         $vote->user = 0;
         $vote->link = $linkres->id;
         $vote->ip = '0.0.0.' . $i;
         $vote->value = $value;
         $vote->insert();
         $vote = "";
         $vote = new Vote();
         $vote->type = 'links';
         $vote->link = $linkres->id;
开发者ID:holsinger,项目名称:openfloor,代码行数:31,代码来源:import_feeds.php

示例12: do_submit1


//.........这里部分代码省略.........
    // Now we check again against the blog table
    // it's done because there could be banned blogs like http://lacotelera.com/something
    if ($ban = check_ban($blog->url, 'hostname', false, true)) {
        $e = _('URL inválido') . ': ' . htmlspecialchars($url);
        add_submit_error($e, _('el sitio') . ' ' . $ban['match'] . ' ' . _('está deshabilitado') . ' (' . $ban['comment'] . ')');
        if ($ban['expire'] > 0) {
            add_submit_error($e, _('caduca') . ': ' . get_date_time($ban['expire']));
        }
        syslog(LOG_NOTICE, "Meneame, banned site ({$current_user->user_login}): {$blog->url} <- " . $_REQUEST['url']);
        return false;
    }
    // check for users spamming several sites and networks
    // it does not allow a low "entropy"
    if ($sents > 30) {
        $ratio = (double) $db->get_var("select count(distinct link_blog)/count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day)");
        $threshold = 1 / log($sents, 2);
        if ($ratio < $threshold) {
            if ($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day) and link_blog = {$blog->id}") > 2) {
                syslog(LOG_NOTICE, "Meneame, forbidden due to low entropy: {$ratio} <  {$threshold}  ({$current_user->user_login}): {$link->url}");
                add_submit_error(_('ya has enviado demasiados enlaces a los mismos sitios'), _('varía las fuentes, podría ser considerado spam'));
                return false;
            }
        }
    }
    // Check the user does not send too many images or vídeos
    // they think this is a fotolog
    if ($sents > 5 && ($link->content_type == 'image' || $link->content_type == 'video')) {
        $image_links = intval($db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60  day) and link_content_type in ('image', 'video')"));
        if ($image_links > $sents * 0.8) {
            syslog(LOG_NOTICE, "Meneame, forbidden due to too many images or video sent by user ({$current_user->user_login}): {$link->url}");
            add_submit_error(_('ya has enviado demasiadas imágenes o vídeos'));
            return false;
        }
    }
    // Avoid users sending too many links to the same site in last hours
    $hours = 24;
    $same_blog = $db->get_var("select count(*) from links where link_date > date_sub(now(), interval {$hours} hour) and link_author={$current_user->user_id} and link_blog={$link->blog} and link_votes > 0");
    if ($same_blog >= $globals['limit_same_site_24_hours']) {
        syslog(LOG_NOTICE, "Meneame, forbidden due to too many links to the same site in last {$hours} hours ({$current_user->user_login}): {$link->url}");
        add_submit_error(_('demasiados enlaces al mismo sitio en las últimas horas'));
        return false;
    }
    // avoid auto-promotion (autobombo)
    $minutes = 30;
    $same_blog = $db->get_var("select count(*) from links where link_date > date_sub(now(), interval {$minutes} minute) and link_author={$current_user->user_id} and link_blog={$link->blog} and link_votes > 0");
    if ($same_blog > 0 && $current_user->user_karma < 12) {
        syslog(LOG_NOTICE, "Meneame, forbidden due to short period between links to same site ({$current_user->user_login}): {$link->url}");
        add_submit_error(_('ya has enviado un enlace al mismo sitio hace poco tiempo'), _('debes esperar') . " {$minutes} " . _('minutos entre cada envío al mismo sitio.') . ', ' . '<a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php">' . _('lee el FAQ') . '</a>');
        return false;
    }
    // Avoid spam (autobombo), count links in last two months
    $same_blog = $db->get_var("select count(*) from links where link_author={$current_user->user_id} and link_date > date_sub(now(), interval 60 day) and link_blog={$link->blog}");
    $check_history = $sents > 3 && $same_blog > 0 && ($ratio = $same_blog / $sents) > 0.5;
    if ($check_history) {
        $e = _('has enviado demasiados enlaces a') . " {$blog->url}";
        if ($sents > 5 && $ratio > 0.75) {
            add_submit_error($e, _('has superado los límites de envíos de este sitio'));
            // don't allow to continue
            syslog(LOG_NOTICE, "Meneame, warn, high ratio, process interrumped ({$current_user->user_login}): {$link->url}");
            return false;
        } else {
            add_submit_error($e, _('continúa, pero ten en cuenta podría recibir votos negativos') . ', ' . '<a href="' . $globals['base_url'] . $globals['legal'] . '">' . _('condiciones de uso') . '</a>');
            syslog(LOG_NOTICE, "Meneame, warn, high ratio, continue ({$current_user->user_login}): {$link->url}");
        }
    }
    $links_12hs = $db->get_var("select count(*) from links where link_date > date_sub(now(), interval 12 hour)");
    // check there is no an "overflow" from the same site
    $site_links = intval($db->get_var("select count(*) from links where link_date > date_sub(now(), interval 12 hour) and link_blog={$link->blog} and link_status in ('queued')"));
    if ($site_links > 10 && $site_links > $links_12hs * 0.05) {
        // Only 5% from the same site
        syslog(LOG_NOTICE, "Meneame, forbidden due to overflow to the same site ({$current_user->user_login}): {$link->url}");
        add_submit_error(_('ya se han enviado demasiadas artículos del mismo sitio, espera unos minutos por favor'), _('total en 12 horas') . ": {$site_links} , " . _('el máximo actual es') . ': ' . intval($links_12hs * 0.05));
        return false;
    }
    // check there is no an "overflow" of images
    if ($link->content_type == 'image' || $link->content_type == 'video') {
        $image_links = intval($db->get_var("select count(*) from links where link_date > date_sub(now(), interval 12 hour) and link_content_type in ('image', 'video')"));
        if ($image_links > 5 && $image_links > $links_12hs * 0.15) {
            // Only 15% images and videos
            syslog(LOG_NOTICE, "Meneame, forbidden due to overflow images ({$current_user->user_login}): {$link->url}");
            add_submit_error(_('ya se han enviado demasiadas imágenes o vídeos, espera unos minutos por favor'), _('total en 12 horas') . ": {$image_links} , " . _('el máximo actual es') . ': ' . intval($links_12hs * 0.05));
            return false;
        }
    }
    if ($ban = check_ban($link->url, 'punished_hostname', false, true)) {
        add_submit_error(_('Aviso') . ' ' . $ban['match'] . ': <em>' . $ban['comment'] . '</em>', _('mejor enviar el enlace a la fuente original, si no, será penalizado'));
    }
    // Now stores new draft
    $link->sent_date = $link->date = time();
    $link->key = $_POST['key'];
    $link->randkey = $_POST['randkey'];
    $link->store();
    $link->url_title = mb_substr($link->url_title, 0, 200);
    if (mb_strlen($link->url_description) > 40) {
        $link->content = $link->url_description;
    }
    $link->chars_left = 550 - mb_strlen(html_entity_decode($link->content, ENT_COMPAT, 'UTF-8'), 'UTF-8');
    Haanga::Load('link/submit1.html', compact('link', 'errors'));
    return true;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:101,代码来源:submit.php

示例13: 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

示例14: 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

示例15: 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


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