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="' . _('« 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 ') . '»' . _(' 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> <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="' . _('« retroceder') . '"> ' . "\n"; echo '<input class="genericsubmit" type="submit" value="' . _('enviar a la cola y finalizar »') . '" />' . "\n"; echo '</form>' . "\n"; echo '</fieldset>' . "\n"; echo '</div>' . "\n"; }
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="« '._('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').'... <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> <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="« '._('retroceder').'"/> '."\n"; echo '<input class="button" type="submit" value="'._('enviar a la cola y finalizar').' »" '; echo '/> <span id="working"> </span>'; echo '</fieldset>'."\n"; echo '</form>'."\n"; echo '</div>'."\n"; }
$linkres->link_field3 = trim($_POST['link_field3']); $linkres->link_field4 = trim($_POST['link_field4']); $linkres->link_field5 = trim($_POST['link_field5']); $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;
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: '******'|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)); } } //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; } $linkres->store(); 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); } $vars = ''; check_actions('submit_step_3_after_first_store', $vars); if ($vars['error'] == true && link_catcha_errors('captcha_error')) { return; } $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', ''); } $data = parse_url($linkres->url); $main_smarty->assign('url_short', $data['host']); $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', str_replace('"', """, $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_center'); $vars = ''; check_actions('do_submit2', $vars); $_SESSION['step'] = 2; if (Submit_Complete_Step2) { do_submit3(); } else { $main_smarty->display($the_template . '/pligg.tpl'); } }
function do_submit3() { global $db, $current_user; $link = new Link(); $link->id = $link_id = intval($_POST['id']); if (!check_link_key() || !$link->read() || link_errors($link)) { die; } // Check it is not in the queue already if (Link::duplicates($link->url)) { // Write headers, they were not printed yet do_header(_('enviar historia'), _('enviar historia')); echo '<div id="singlewrap">' . "\n"; report_duplicated($link->url); return; } // Check this one was not already queued if ($link->votes == 0 && $link->status != 'queued') { $link->enqueue(); } header('Location: ' . $link->get_permalink()); die; }