コード例 #1
0
ファイル: editlink.php プロジェクト: brainsqueezer/fffff
function do_save()
{
    global $linkres, $dblang, $current_user;
    $linkres->read_content_type_buttons($_POST['type']);
    $linkres->category = intval($_POST['category']);
    if (!empty($_POST['url']) && ($current_user->user_level == 'admin' || $current_user->user_level == 'god')) {
        $linkres->url = clean_input_url($_POST['url']);
    }
    $linkres->title = clean_text($_POST['title'], 40);
    $linkres->content = clean_text($_POST['bodytext']);
    $linkres->tags = tags_normalize_string($_POST['tags']);
    // change the status
    if (($current_user->user_level == 'god' || $linkres->status != 'published') && ($_POST['status'] == 'queued' || $_POST['status'] == 'discard' || $_POST['status'] == 'abuse' || $_POST['status'] == 'autodiscard')) {
        if (!$linkres->is_discarded() && ($_POST['status'] == 'discard' || $_POST['status'] == 'abuse' || $_POST['status'] == 'autodiscard')) {
            // Insert a log entry if the link has been manually discarded
            $insert_discard_log = true;
        }
        $linkres->status = $_POST['status'];
    }
    if (!link_edit_errors($linkres)) {
        if (empty($linkres->uri)) {
            $linkres->get_uri();
        }
        $linkres->store();
        tags_insert_string($linkres->id, $dblang, $linkres->tags, $linkres->date);
        // Insert edit log/event
        require_once mnminclude . 'log.php';
        if ($insert_discard_log) {
            // Insert always a link and discard event if the status has been changed to discard
            log_insert('link_discard', $linkres->id, $current_user->user_id);
            log_insert('link_edit', $linkres->id, $current_user->user_id);
        } else {
            log_conditional_insert('link_edit', $linkres->id, $current_user->user_id, 60);
        }
        echo '<div class="form-error-submit">&nbsp;&nbsp;' . _("noticia actualizada") . '</div>' . "\n";
    }
    $linkres->read();
    echo '<div class="formnotice">' . "\n";
    $linkres->print_summary('preview');
    echo '</div>' . "\n";
    echo '<form id="genericform" method="GET" action="story.php" >';
    echo '<input type="hidden" name="id" value="' . $linkres->id . '" />' . "\n";
    echo '<input class="genericsubmit" type="button" onclick="window.history.go(-1)" value="' . _('&#171; modificar') . '">&nbsp;&nbsp;' . "\n";
    echo '<input class="genericsubmit" type="submit" value="' . _('ir a la noticia') . '" />' . "\n";
    echo '</form>' . "\n";
}
コード例 #2
0
function do_save() {
	global $linkres, $dblang;

	$linkres->category=$_POST['category'];
	if (!empty($_POST['url'])) {
		$linkres->url = trim($_POST['url']);
	}
	$linkres->title = stripslashes(clean_text($_POST['title']));
	$linkres->content = stripslashes(clean_text($_POST['bodytext']));
	$linkres->tags = tags_normalize_string(stripslashes(clean_text($_POST['tags'])));
	// change the status
	if ($linkres->status != 'published' && ($_POST['status'] == 'queued' || $_POST['status'] == 'discard')) {
		$linkres->status = $_POST['status'];
	}
	if (!link_edit_errors($linkres)) {
		$linkres->store();
		tags_insert_string($linkres->id, $dblang, $linkres->tags, $linkres->date);
		echo '<div class="form-error-submit">&nbsp;&nbsp;'._("noticia actualizada").'</div>'."\n";
	} else {
		$linkres->read();
	}

	echo '<div class="formnotice">'."\n";
	$linkres->print_summary('preview');
	echo '</div>'."\n";

	echo '<form id="genericform" method="GET" action="story.php" >';
	echo '<input type="hidden" name="id" value="'.$linkres->id.'" />'."\n";
	echo '<input class="genericsubmit" type="button" onclick="window.history.go(-1)" value="'._('&#171; modificar').'">&nbsp;&nbsp;'."\n";;
	echo '<input class="genericsubmit" type="submit" value="'._('ir a la noticia').'" />'."\n";
	echo '</form>'. "\n";

}
コード例 #3
0
ファイル: submit.php プロジェクト: brainsqueezer/fffff
function do_submit2()
{
    global $db, $dblang;
    $linkres = new Link();
    $linkres->id = $link_id = intval($_POST['id']);
    $linkres->read();
    $linkres->category = intval($_POST['category']);
    $linkres->title = clean_text($_POST['title'], 40);
    $linkres->tags = tags_normalize_string(clean_text($_POST['tags']));
    $linkres->content = clean_text($_POST['bodytext']);
    if (link_errors($linkres)) {
        echo '<form id="genericform">' . "\n";
        echo '<p><input class="genericsubmit" type=button onclick="window.history.go(-1)" value="' . _('&#171; retroceder') . '"></p>' . "\n";
        echo '</form>' . "\n";
        echo '</div>' . "\n";
        // opened in print_form_submit_error
        return;
    }
    $linkres->store();
    tags_insert_string($linkres->id, $dblang, $linkres->tags);
    $linkres->read();
    $edit = true;
    $link_title = $linkres->title;
    $link_content = $linkres->content;
    do_navbar(_('enviar noticia ') . '&#187;' . _(' paso 3: control final'));
    echo '<div id="genericform-contents">' . "\n";
    echo '<h2>' . _('envío de una nueva noticia: paso 3 de 3') . '</h2>' . "\n";
    echo '<form action="submit.php" method="post" id="genericform">' . "\n";
    echo '<fieldset><legend><span class="sign">' . _('detalles de la noticia') . '</span></legend>' . "\n";
    echo '<div class="genericformtxt"><label>' . _('ATENCIÓN: esto es sólo una muestra!') . '</label>&nbsp;&nbsp;<br/>' . _('Ahora puedes 1) ') . '<label>' . _('retroceder') . '</label>' . _(' o 2)  ') . '<label>' . _('enviar a la cola y finalizar') . '</label>' . _('. Cualquier otro clic convertirá tu noticia en comida para <del>gatos</del> elefantes (o no).') . '</div>';
    echo '<div class="formnotice">' . "\n";
    $linkres->print_summary('preview');
    echo '</div>' . "\n";
    echo '<input type="hidden" name="phase" value="3" />' . "\n";
    echo '<input type="hidden" name="randkey" value="' . intval($_POST['randkey']) . '" />' . "\n";
    echo '<input type="hidden" name="id" value="' . $linkres->id . '" />' . "\n";
    echo '<input type="hidden" name="trackback" value="' . htmlspecialchars(trim($_POST['trackback'])) . '" />' . "\n";
    echo '<br style="clear: both;" /><br style="clear: both;" />' . "\n";
    echo '<input class="genericsubmit" type="button" onclick="window.history.go(-1)" value="' . _('&#171; retroceder') . '">&nbsp;&nbsp;' . "\n";
    echo '<input class="genericsubmit" type="submit" value="' . _('enviar a la cola y finalizar &#187;') . '" />' . "\n";
    echo '</form>' . "\n";
    echo '</fieldset>' . "\n";
    echo '</div>' . "\n";
}
コード例 #4
0
function do_submit2()
{
    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);
    tags_insert_string($_SESSION['newSid'], $dblang, $linkres->tags);
    $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:/colfusion/story.php?title={$Sid}");
    $vars = '';
    check_actions('do_submit2', $vars);
    $_SESSION['step'] = 2;
    $main_smarty->display($the_template . '/pligg.tpl');
}
コード例 #5
0
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: '******'|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');
}
コード例 #6
0
ファイル: editlink.php プロジェクト: rasomu/chuza
function do_save() {
	global $linkres, $dblang, $current_user;

	$linkres->read_content_type_buttons($_POST['type']);

	$linkres->category=intval($_POST['category']);
	if ($current_user->admin) {
		if (!empty($_POST['url'])) {
			$linkres->url = clean_input_url($_POST['url']);
		}
		if ($_POST['thumb_delete']) {
			$linkres->delete_thumb();
		}
		if ($_POST['thumb_get']) {
			$linkres->get_thumb();
		}
	}
	$linkres->title = clean_text($_POST['title'], 40);
	$linkres->content = clean_text_with_tags($_POST['bodytext']);
	$linkres->tags = tags_normalize_string($_POST['tags']);
	// change the status
	if ($_POST['status'] != $linkres->status
		&& ($_POST['status'] == 'autodiscard' || $current_user->admin)
		&& preg_match('/^[a-z]{4,}$/', $_POST['status'])
		&& ( ! $linkres->is_discarded() || $current_user->admin)) {
		if (preg_match('/discard|abuse|duplicated|autodiscard/', $_POST['status'])) {
			// Insert a log entry if the link has been manually discarded
			$insert_discard_log = true;
		}
		$linkres->status = $_POST['status'];
	}

  // EVENTS
  $d = $_POST["datepicker1"];
  $linkres->start_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);

  $d = $_POST["datepicker2"];
  $linkres->end_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);


	if (!link_edit_errors($linkres)) {
		if (empty($linkres->uri)) $linkres->get_uri();
		$linkres->store();
		tags_insert_string($linkres->id, $dblang, $linkres->tags, $linkres->date);

		// Insert edit log/event if the link it's newer than 15 days
		if ($globals['now'] - $linkres->date < 86400*15) {
			require_once(mnminclude.'log.php');
			if ($insert_discard_log) {
				// Insert always a link and discard event if the status has been changed to discard
				log_insert('link_discard', $linkres->id, $current_user->user_id);
				if ($linkres->author == $current_user->user_id) { // Don't save edit log if it's discarded by an admin
					log_insert('link_edit', $linkres->id, $current_user->user_id);
				}
			} elseif ($linkres->votes > 0) {
				log_conditional_insert('link_edit', $linkres->id, $current_user->user_id, 60);
			}
		}

		echo '<div class="form-error-submit">&nbsp;&nbsp;'._("noticia actualizada").'</div>'."\n";
	}

	$linkres->read();

	echo '<div class="formnotice">'."\n";
	$linkres->print_summary('preview');
	echo '</div>'."\n";

	echo '<form class="note" method="GET" action="story.php" >';
	echo '<input type="hidden" name="id" value="'.$linkres->id.'" />'."\n";
	echo '<input class="button" type="button" onclick="window.history.go(-1)" value="&#171; '._('modificar').'">&nbsp;&nbsp;'."\n";;
	echo '<input class="button" type="submit" value="'._('ir a la noticia').'" />'."\n";
	echo '</form>'. "\n";
}
コード例 #7
0
ファイル: submit.php プロジェクト: rasomu/chuza
function do_submit2() {
	global $db, $dblang, $globals;


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

	if(report_dupe($linkres->url)) return;

	$linkres->read_content_type_buttons($_POST['type']);

	// Check if the title contains [IMG], [IMGs], (IMG)... and mark it as image

	if (preg_match('/[\(\[](IMG|PICT*)s*[\)\]]/i', $_POST['title'])) {
		$_POST['title'] = preg_replace('/[\(\[](IMG|PICT*)s*[\)\]]/i', ' ', $_POST['title']);
		$linkres->content_type = 'image';
	} elseif (preg_match('/[\(\[](VID|VIDEO|Vídeo*)s*[\)\]]/i', $_POST['title'])) {
		$_POST['title'] = preg_replace('/[\(\[](VID|VIDEO|Vídeo*)s*[\)\]]/i', ' ', $_POST['title']);
		$linkres->content_type = 'video';
	}

	$linkres->category=intval($_POST['category']);
	$linkres->title = clean_text(preg_replace('/(\w) *[;.,] *$/', "$1", $_POST['title']), 40);  // It also deletes punctuaction signs at the end
	$linkres->tags = tags_normalize_string($_POST['tags']);
	$linkres->content = clean_text_with_tags($_POST['bodytext']);
  // EVENTS
  $d = $_POST["datepicker1"];
  $linkres->start_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);

  $d = $_POST["datepicker2"];
  $linkres->end_date = substr($d,3,2).'-'.substr($d, 0, 2).'-'.substr($d,6,4);

	if (link_errors($linkres)) {
		echo '<form class="genericform">'."\n";
		echo '<p><input class="button" type=button onclick="window.history.go(-1)" value="&#171; '._('retroceder').'"/></p>'."\n";
		echo '</form>'."\n";
		echo '</div>'."\n"; // opened in print_form_submit_error
		return;
	}

	$linkres->store();
	tags_insert_string($linkres->id, $dblang, $linkres->tags);
	$linkres->read();
	$edit = true;
	$link_title = $linkres->title;
	$link_content = $linkres->content;
	preload_indicators();
	echo '<div class="genericform">'."\n";
	
	echo '<h2>'._('envío de una nueva noticia: paso 3 de 3').'</h2>'."\n";

	echo '<form action="submit.php" method="post" class="genericform" onSubmit="$(\'#working\').html(\''._('enviando trackbacks').'...&nbsp;<img src=\\\'\'+img_src1+\'\\\'/>\'); return true;">'."\n";
	echo '<fieldset><legend><span class="sign">'._('detalles de la noticia').'</span></legend>'."\n";

	echo '<div class="genericformtxt"><label>'._('ATENCIÓN: esto es sólo una muestra!').'</label>&nbsp;&nbsp;<br/>'._('Ahora puedes 1) ').'<label>'._('retroceder').'</label>'._(' o 2)  ').'<label>'._('enviar a la cola y finalizar').'</label>. '._('Cualquier otro clic convertirá tu noticia en comida para <del>gatos</del> elefantes (o no).').'</div>';	

	echo '<div class="formnotice">'."\n";
	$linkres->print_summary('preview');
	echo '</div>'."\n";

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

	echo '<br style="clear: both;" /><br style="clear: both;" />'."\n";
	echo '<input class="button" type="button" onclick="window.history.go(-1)" value="&#171; '._('retroceder').'"/>&nbsp;&nbsp;'."\n";
	echo '<input class="button" type="submit" value="'._('enviar a la cola y finalizar').' &#187;" ';
	echo '/>&nbsp;&nbsp;&nbsp;<span id="working">&nbsp;</span>';
	echo '</fieldset>'."\n";
	echo '</form>'."\n";
	echo '</div>'."\n";
}
コード例 #8
0
ファイル: submit.php プロジェクト: bendroid/pligg-cms
function do_submit3()
{
    global $db, $dblang;
    $linkres = new Link();
    $linkres->id = sanitize($_POST['id'], 3);
    if (!is_numeric($linkres->id)) {
        die;
    }
    if (!Submit_Complete_Step2 && $_SESSION['step'] != 2) {
        die('Wrong step');
    }
    $linkres->read();
    totals_adjust_count($linkres->status, -1);
    totals_adjust_count('new', 1);
    $linkres->status = 'new';
    $vars = array('linkres' => &$linkres);
    check_actions('do_submit3', $vars);
    $linkres->status = $vars['linkres']->status;
    if ($vars['linkres']->status == 'discard') {
        $vars = array('link_id' => $linkres->id);
        check_actions('story_discard', $vars);
    } elseif ($vars['linkres']->status == 'spam') {
        $vars = array('link_id' => $linkres->id);
        check_actions('story_spam', $vars);
    }
    $linkres->store_basic();
    $linkres->check_should_publish();
    tags_insert_string($linkres->id, $dblang, $linkres->tags);
    if (isset($_POST['trackback']) && sanitize($_POST['trackback'], 3) != '') {
        require_once mnminclude . 'trackback.php';
        $trackres = new Trackback();
        $trackres->url = sanitize($_POST['trackback'], 3);
        $trackres->link = $linkres->id;
        $trackres->title = $linkres->title;
        $trackres->author = $linkres->author;
        $trackres->content = $linkres->content;
        $res = $trackres->send();
    }
    $vars = array('linkres' => $linkres);
    check_actions('submit_pre_redirect', $vars);
    if ($vars['redirect']) {
        header('Location: ' . $vars['redirect']);
    } elseif ($linkres->link_group_id == 0) {
        header("Location: " . getmyurl('new'));
    } else {
        $redirect = getmyurl("group_story", $linkres->link_group_id);
        header("Location: {$redirect}");
    }
    die;
}
コード例 #9
0
ファイル: editlink.php プロジェクト: holsinger/openfloor
     $linkres->link_field6 = trim($_POST['link_field6']);
     $linkres->link_field7 = trim($_POST['link_field7']);
     $linkres->link_field8 = trim($_POST['link_field8']);
     $linkres->link_field9 = trim($_POST['link_field9']);
     $linkres->link_field10 = trim($_POST['link_field10']);
     $linkres->link_field11 = trim($_POST['link_field11']);
     $linkres->link_field12 = trim($_POST['link_field12']);
     $linkres->link_field13 = trim($_POST['link_field13']);
     $linkres->link_field14 = trim($_POST['link_field14']);
     $linkres->link_field15 = trim($_POST['link_field15']);
     // Steef: replace newlines for linebreaks
     $linkres->content = str_replace("\n", "<br />", $linkres->content);
     if (link_errors($linkres)) {
         return;
     }
     tags_insert_string($linkres->id, $dblang, $linkres->tags);
     $linkres->store();
     header('Location: ' . getmyurl('story', $_POST['id']));
 } else {
     $linkres = new Link();
     $edit = false;
     $link_id = $_GET['id'];
     $linkres->id = $link_id;
     $linkres->read();
     $link_title = $linkres->title;
     $link_content = str_replace("<br />", "\n", $linkres->content);
     $link_category = $linkres->category;
     $link_summary = $linkres->link_summary;
     $link_summary = str_replace("<br />", "\n", $link_summary);
     $main_smarty->assign('enable_tags', Enable_Tags);
     $main_smarty->assign('submit_url', $linkres->url);
コード例 #10
0
function do_the_import_stuff($feed)
{
    global $db, $dblang, $RSSImport;
    $RSSImport = new RSSImport();
    $added_one = false;
    $url = $feed->feed_url;
    $rss = fetch_rss($url);
    if ($_GET['override'] == $feed->feed_id) {
        $canIhaveAccess = 0;
        $canIhaveAccess = $canIhaveAccess + checklevel('god');
        if (!$canIhaveAccess == 1) {
            die('You are not authorized to override.');
        }
    }
    $MyArray = array();
    $Feed_Links = $RSSImport->get_feed_field_links($feed->feed_id);
    if (count($Feed_Links) > 0) {
        foreach ($Feed_Links as $link) {
            if ($link->pligg_field == 'link_title') {
                $MyArray['title'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_content') {
                $MyArray['content'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_url') {
                $MyArray['link_url'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_tags') {
                $MyArray['link_tags'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field1') {
                $MyArray['link_field1'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field2') {
                $MyArray['link_field2'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field3') {
                $MyArray['link_field3'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field4') {
                $MyArray['link_field4'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field5') {
                $MyArray['link_field5'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field6') {
                $MyArray['link_field6'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field7') {
                $MyArray['link_field7'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field8') {
                $MyArray['link_field8'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field9') {
                $MyArray['link_field9'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field10') {
                $MyArray['link_field10'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field11') {
                $MyArray['link_field11'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field12') {
                $MyArray['link_field12'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field13') {
                $MyArray['link_field13'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field14') {
                $MyArray['link_field14'] = $link->feed_field;
            }
            if ($link->pligg_field == 'link_field15') {
                $MyArray['link_field15'] = $link->feed_field;
            }
        }
        $thecount = 0;
        if ($feed->feed_last_item_first == 0) {
            $the_items = array_reverse($rss->items);
        } else {
            $the_items = $rss->items;
        }
        foreach ($the_items as $item) {
            echo "<strong>Title: " . get_val($item, $MyArray['title']) . "</strong><br/>";
            echo "<strong>Content:</strong> " . strip_tags(substr(get_val($item, $MyArray['content']), 0, 256)) . "...<br>";
            echo "<strong>URL:</strong> " . get_val($item, $MyArray['link_url']) . "<br/>";
            $skipthis = 0;
            $linkres = new Link();
            $linkres->randkey = rand(10000, 10000000);
            $linkres->status = $feed->feed_status;
            $linkres->author = $feed->feed_submitter;
            $linkres->title = get_val($item, $MyArray['title']);
            $linkres->title = strip_tags($linkres->title);
            $linkres->tags = get_val($item, $MyArray['link_tags']);
            // MJE: MOD to include title words as tags ----------------------------
            if (trim($linkres->tags) == '') {
                $temp1 = strtolower($linkres->title);
                $stopwords = file(mnmpath . '/modules/rss_import/templates/stopwords.txt');
                for ($zz = 0; $zz < count($stopwords); $zz++) {
                    $pos = strpos($temp1, $stopwords[$zz] . ' ');
                    if ($pos !== false && $pos == 0) {
                        $temp1 = str_replace(trim($stopwords[$zz]) . ' ', ' ', $temp1);
                    }
                    $temp1 = str_replace(' ' . trim($stopwords[$zz]) . ' ', ' ', $temp1);
                }
                $pos = strpos($temp1, '  ');
                while ($pos !== false) {
                    $temp1 = str_replace('  ', ' ', $temp1);
                    $pos = strpos($temp1, '  ');
                }
                $temp1 = str_replace(' ', ", ", $temp1);
                // $out = ereg_replace("[^[:alpha:]]", "", $in);
                // 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;
    }
}
コード例 #11
0
ファイル: submit.php プロジェクト: pantofla/waterfan
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);
    if ($current_user->authenticated != TRUE) {
        $vars = array('username' => $current_user->user_login);
        check_actions('register_check_errors', $vars);
    }
    if ($vars['error'] == true) {
        if (link_catcha_errors('captcha_error')) {
            return;
        }
    } else {
        $linkres = new Link();
        $linkres->id = sanitize($_POST['id'], 3);
        if (!is_numeric($linkres->id)) {
            die;
        }
        if (!$linkres->verify_ownership($current_user->user_id)) {
            die($main_smarty->get_config_vars('PLIGG_Visual_Submit2Errors_NoAccess'));
        }
        define('pagename', 'submit');
        $main_smarty->assign('pagename', pagename);
        $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);
        }
        $linkres->category = sanitize($_POST['category'], 3);
        $linkres->title = sanitize($_POST['title'], 3);
        $linkres->title_url = makeUrlFriendly($linkres->title);
        $linkres->tags = tags_normalize_string(sanitize($_POST['tags'], 3));
        $linkres->content = sanitize($_POST['bodytext'], 4, $Story_Content_Tags_To_Allow);
        $linkres->content = str_replace("\n", "<br />", $linkres->content);
        // Steef 2k7-07 security fix start ----------------------------------------------------------
        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);
        }
        // Steef 2k7-07 security fix end --------------------------------------------------------------
        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 = str_replace("\n", "<br />", $linkres->link_summary);
        } else {
            $linkres->link_summary = sanitize($_POST['summarytext'], 4, $Story_Content_Tags_To_Allow);
            $linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
            if (strlen($linkres->link_summary) > StorySummary_ContentTruncate) {
                loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: '******'|email: ' . sanitize($_POST["email"], 3), true);
                $linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
                $linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
            }
        }
        //get link_group_id
        if (isset($_REQUEST['link_group_id']) && $_REQUEST['link_group_id'] != '') {
            $linkres->link_group_id = intval($_REQUEST['link_group_id']);
        } else {
            $linkres->link_group_id = 0;
        }
        if (link_errors($linkres)) {
            return;
        }
        //comment subscription
        if (isset($_POST['comment_subscription'])) {
            $vars = array('link_id' => $linkres->id);
            check_actions('comment_subscription_insert_function', $vars);
        }
        //comment subscription
        if (isset($_POST['timestamp_date_day'])) {
            //open date
            $timestamp_date_day = $_POST['timestamp_date_day'];
            $timestamp_date_month = $_POST['timestamp_date_month'];
            $timestamp_date_year = $_POST['timestamp_date_year'];
            if (!is_numeric($timestamp_date_day) || !is_numeric($timestamp_date_month) || !is_numeric($timestamp_date_year)) {
                $timestamp_date = date("m-d-Y");
            } else {
                $timestamp_date = $timestamp_date_month . "-" . $timestamp_date_day . "-" . $timestamp_date_year;
            }
            $vars = array('link_id' => $linkres->id);
            $vars = array('timestamp_date' => $timestamp_date, 'link_id' => $linkres->id);
            check_actions('comment_subscription_insert_function', $vars);
        }
        $linkres->store();
        tags_insert_string($linkres->id, $dblang, $linkres->tags);
        $vars = '';
        check_actions('submit_step_3_after_first_store', $vars);
        $linkres->read(FALSE);
        $edit = true;
        $link_title = $linkres->title;
        $link_content = $linkres->content;
        $link_title = stripslashes(sanitize($_POST['title'], 3));
        $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);
        }
        if (isset($url)) {
            $main_smarty->assign('submit_url', $url);
        } else {
            $main_smarty->assign('submit_url', '');
        }
        $main_smarty->assign('submit_url_title', $linkres->url_title);
        $main_smarty->assign('submit_id', $linkres->id);
        $main_smarty->assign('submit_type', $linkres->type());
        $main_smarty->assign('submit_title', $link_title);
        $main_smarty->assign('submit_content', $link_content);
        if (isset($trackback)) {
            $main_smarty->assign('submit_trackback', $trackback);
        } else {
            $main_smarty->assign('submit_trackback', '');
        }
        $main_smarty->assign('tpl_extra_fields', $the_template . '/submit_extra_fields');
        $main_smarty->assign('tpl_center', $the_template . '/submit_step_3');
        $vars = '';
        check_actions('do_submit2', $vars);
        $main_smarty->display($the_template . '/pligg.tpl');
    }
}