function promote_from_subs($destination, $hours, $min_karma, $min_votes) { global $db; echo "Promote to main: {$destination}\n"; $res = $db->get_results("select sub_statuses.*, link_url, link_karma, link_votes from sub_statuses, subs, links where date > date_sub(now(), interval {$hours} hour) and status = 'published' and link_karma >= {$min_karma} and sub_statuses.id = origen and subs.id = sub_statuses.id and subs.created_from = {$destination} and not subs.private and not subs.nsfw and sub_statuses.id not in (select src from subs_copy where dst={$destination}) and {$destination} not in (select id from sub_statuses as t where t.link=sub_statuses.link) and link_id = sub_statuses.link and link_votes >= {$min_votes}"); foreach ($res as $status) { // If there are more of the same sub in queue or published, multiply minimums $promoted = $db->get_var("select count(*) from sub_statuses where id = {$destination} and origen = {$status->id} and date > date_sub(now(), interval {$hours} hour)"); echo "PROMOTED {$status->id} -> {$destination}: {$promoted}\n"; if ($promoted > 0 && $status->link_karma < min(4, $promoted * 0.5 + 1) * $min_karma && $status->link_votes < min(4, $promoted * 0.5 + 1) * $min_votes) { echo "Already in main {$promoted}, doesn't have minimums, {$status->link_url}\n"; continue; } $properties = SitesMgr::get_extended_properties($status->id); if (!empty($properties['no_link']) && empty($status->link_url)) { echo "NO LINK, {$status->id}\n"; // continue; } if (!empty($status->link_url) && Link::duplicates($status->link_url, $destination)) { echo "Duplicated in destination, {$status->link_url}\n"; continue; } $status->id = $destination; $status->status = 'queued'; echo "--->\n"; if (!DEBUG) { SitesMgr::store($status); } } }
function do_submit1() { global $db, $dblang, $current_user, $globals; do_navbar(_('enviar noticia ') . '»' . _(' paso 2: detalles')); echo '<div id="genericform-contents">' . "\n"; if ($globals['min_karma_for_links'] > 0 && $current_user->user_karma < $globals['min_karma_for_links']) { echo '<p class="error"><strong>' . _('no tienes el mínimo de karma para enviar una nueva historia') . '</strong></p> '; echo '<br style="clear: both;" />' . "\n"; echo '</div>' . "\n"; return; } // avoid spams, an extra security check $from = time() - 7200; $same_user = $db->get_var("select count(*) from links where link_date > from_unixtime({$from}) and link_author={$current_user->user_id}"); $same_ip = $db->get_var("select count(*) from links, votes where link_date > from_unixtime({$from}) and vote_type='links' and vote_link_id = link_id and vote_user_id = link_author and vote_ip_int = " . $globals['user_ip_int']); echo "<!-- Same user: {$same_user} -->\n"; echo "<!-- Same IP: {$same_ip} -->\n"; if ($same_user > 4 || $same_ip > 4) { echo '<p class="error"><strong>' . _('debes esperar, ya se enviaron varias con el mismo usuario o dirección IP') . '</strong></p>'; echo '<br style="clear: both;" />' . "\n"; echo '</div>' . "\n"; return; } $url = clean_input_url($_POST['url']); $linkres = new Link(); $edit = false; if ($found = $linkres->duplicates($url)) { echo '<p class="error"><strong>' . _('noticia repetida!') . '</strong></p> '; echo '<p class="error-text">' . _('lo sentimos') . '</p>'; echo '<p class="error-text"><a href="' . $globals['base_url'] . '?search=' . htmlspecialchars($found) . '">' . _('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="' . _('« retroceder') . '" />'; echo '</form>' . "\n"; echo '</div>' . "\n"; return; } if (!$linkres->get($url)) { echo '<p class="error"><strong>' . _('URL inválido') . ':</strong> ' . htmlspecialchars($url) . '</p>'; echo '<p>' . _('URL inválido, incompleto o no permitido') . '</p>'; // If the domain is banned, decrease user's karma if ($linkres->banned) { $db->query("update users set user_karma = user_karma - 0.1 where user_id = {$current_user->user_id}"); } print_empty_submit_form(); echo '</div>' . "\n"; return; } $trackback = $linkres->trackback; $linkres->randkey = intval($_POST['randkey']); if (!$linkres->valid) { echo '<p class="error"><strong>' . _('error leyendo el url') . ':</strong> ' . htmlspecialchars($url) . '</p>'; // Dont allow new users with low karma to post wrong URLs if ($current_user->user_karma < 7 && $current_user->user_level == 'normal') { echo '<p>' . _('URL inválido, incompleto o no permitido') . '</p>'; print_empty_submit_form(); return; } echo '<p>' . _('no es válido, está fuera de línea, o tiene mecanismos antibots, <strong>continúa</strong>, pero asegúrate que sea correcto') . '</p>'; } // check that the user also votes, not only sends links if ($current_user->user_karma < 7) { $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 = min(4, 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="' . $globals['base_url'] . 'shakeit.php" target="_blank">' . _('haz clic aquí para ir a votar') . '</a></p>'; echo '<br style="clear: both;" />' . "\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"); *****/ $linkres->create_blog_entry(); // avoid auto-promotion (autobombo) $hours = 2; $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="' . $globals['base_url'] . 'faq-' . $dblang . '.php">' . _('lee el FAQ') . '</a></p>'; echo '<br style="clear: both;" />' . "\n"; echo '</div>' . "\n"; return; } // 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" name="thisform">' . "\n"; echo '<input type="hidden" name="url" id="url" value="' . htmlspecialchars($linkres->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"; } else { echo "</p>\n"; } echo '</fieldset>' . "\n"; echo '<fieldset><legend><span class="sign">' . _('detalles de la noticia') . '</span></legend>' . "\n"; echo '<label for="title" accesskey="2">' . _('título de la noticia') . ':</label>' . "\n"; echo '<p><span class="genericformnote">' . _('título de la noticia. máximo: 120 caracteres') . '</span>' . "\n"; echo '<br/><input type="text" id="title" name="title" value="' . $link_title . '" size="80" maxlength="120" /></p>' . "\n"; echo '<label for="tags" accesskey="4">' . _('etiquetas') . ':</label>' . "\n"; echo '<p><span class="genericformnote"><strong>' . _('pocas palabras, genéricas, cortas y separadas por "," (coma)') . '</strong> Ejemplo: <em>web, programación, software libre</em></span>' . "\n"; echo '<br/><input type="text" id="tags" name="tags" value="' . $link_tags . '" size="70" maxlength="70" /></p>' . "\n"; echo '<div style="float: right;">'; print_simpleformat_buttons('bodytext'); echo '</div>'; echo '<p><label for="bodytext" accesskey="3">' . _('descripción de la noticia') . ':</label>' . "\n"; echo '<br /><span class="genericformnote">' . _('describe la noticia con tus palabras. entre dos y cinco frases es suficiente. sé cuidadoso.') . '</span>' . "\n"; echo '<br /><textarea name="bodytext" rows="10" cols="60" id="bodytext" onKeyDown="textCounter(document.thisform.bodytext,document.thisform.bodycounter,550)" onKeyUp="textCounter(document.thisform.bodytext,document.thisform.bodycounter,550)"></textarea>' . "\n"; echo '<br /><input readonly type="text" name="bodycounter" size="3" maxlength="3" value="550" /> <span class="genericformnote">' . _('caracteres libres') . '</span>'; echo '</p>' . "\n"; echo '<p><label accesskey="5">' . _('categoría') . ':</label><br />' . "\n"; echo '<span class="genericformnote">' . _('selecciona la categoría más apropiada') . '</span></p>' . "\n"; echo '<div class="column-list">' . "\n"; echo '<div class="categorylist">' . "\n"; echo '<ul>' . "\n"; $categories = $db->get_results("SELECT category_id, category_name FROM categories WHERE category_lang='{$dblang}' ORDER BY category_name ASC"); foreach ($categories as $category) { echo '<li><input name="category" type="radio" value="' . $category->category_id . '"/>' . _($category->category_name) . '</li>' . "\n"; } // TODO: no standard echo '<br style="clear: both;" />' . "\n"; echo '</ul></div></div>' . "\n"; echo '<p><label for="trackback">' . _('trackback') . ':</label><br />' . "\n"; echo '<span class="genericformnote">' . _('puedes agregar o cambiar el trackback si ha sido detectado automáticamente') . '</span>' . "\n"; echo '<input type="text" name="trackback" id="trackback" value="' . $trackback . '" class="form-full" /></p>' . "\n"; echo '<input class="genericsubmit" type="button" onclick="window.history.go(-1)" value="' . _('« retroceder') . '" /> ' . "\n"; echo '<input class="genericsubmit" type="submit" value="' . _('continuar »') . '" />' . "\n"; echo '</fieldset>' . "\n"; echo '</form>' . "\n"; echo '</div>' . "\n"; echo '</div>' . "\n"; }
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="'._('« 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"; } else { echo "</p>\n"; } echo '</fieldset>'."\n"; echo '<fieldset><legend><span class="sign">'._('detalles de la noticia').'</span></legend>'."\n"; echo '<label for="title" accesskey="2">'._('título de la noticia').':</label>'."\n"; echo '<p><span class="genericformnote">'._('título de la noticia. máximo: 120 caracteres').'</span>'."\n"; echo '<br/><input type="text" id="title" name="title" value="'.$link_title.'" size="60" maxlength="120" /></p>'."\n"; echo '<label for="tags" accesskey="4">'._('etiquetas').':</label>'."\n"; echo '<p><span class="genericformnote"><strong>'._('pocas palabras, genéricas, cortas y separadas por "," (coma)').'</strong> Ejemplo: <em>web, programación, software libre</em></span>'."\n"; echo '<br/><input type="text" id="tags" name="tags" value="'.$link_tags.'" size="40" maxlength="40" /></p>'."\n"; echo '<p><label for="bodytext" accesskey="3">'._('descripción de la noticia').':</label>'."\n"; echo '<br /><span class="genericformnote">'._('describe la noticia con tus palabras. entre dos y cinco frases es suficiente. sé cuidadoso.').'</span>'."\n"; echo '<br/><textarea name="bodytext" rows="10" cols="60" id="bodytext" >'.$link_content.'</textarea></p>'."\n"; echo '<p><label accesskey="5">'._('categoría').':</label><br />'."\n"; echo '<span class="genericformnote">'._('selecciona la categoría más apropiada').'</span></p>'."\n"; echo '<div class="column-list">'."\n"; echo '<div class="categorylist">'."\n"; echo '<ul>'."\n"; $categories = $db->get_results("SELECT category_id, category_name FROM categories WHERE category_lang='$dblang' ORDER BY category_name ASC"); foreach ($categories as $category) { echo '<li><input name="category" type="radio" value="'.$category->category_id.'"/>'._($category->category_name).'</li>'."\n"; } // TODO: no standard echo '<br style="clear: both;" />' . "\n"; echo '</ul></div></div>'."\n"; echo '<p><label for="trackback">'._('trackback').':</label><br />'."\n"; echo '<span class="genericformnote">'._('puedes agregar o cambiar el trackback si ha sido detectado automáticamente').'</span>'."\n"; echo '<input type="text" name="trackback" id="trackback" value="'.$trackback.'" class="form-full" /></p>'."\n"; echo '<input class="genericsubmit" type="button" onclick="window.history.go(-1)" value="'._('« retroceder').'"> '."\n"; echo '<input class="genericsubmit" type="submit" value="'._('continuar »').'" />'."\n"; echo '</fieldset>'."\n"; echo '</form>'."\n"; echo '</div>'."\n"; echo '</div>'."\n"; }
function report_dupe($url) { global $globals; $link = new Link; if(($found = $link->duplicates($url))) { $dupe = new Link; $dupe->id = $found; $dupe->read(); echo '<p class="error"><strong>'._('noticia repetida').'</strong></p> '; echo '<p class="error-text">'._('disculpas').'</p>'; $dupe->print_summary(); echo '<br style="clear: both;" /><br/>' . "\n"; echo '<form class="genericform" action="">'; echo '<input class="button" type="button" onclick="window.history.go(-1)" value="« '._('retroceder').'" />'; echo '</form>'. "\n"; echo '</div>'. "\n"; return true; } return false; }
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; } }
$linkres->category = $feed->feed_category; $linkres->link_summary = utf8_substr($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>"; $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;
function report_duplicated($url) { global $globals; if ($found = Link::duplicates($url)) { $link = new Link(); $link->id = $found; $link->read(); Haanga::Load('link/duplicated.html', compact('link')); return true; } return false; }
function do_submit1() { global $main_smarty, $db, $dblang, $current_user, $the_template; $url = htmlspecialchars(strip_tags(trim($_POST['url']))); $url = html_entity_decode($url); // thanks czytom $linkres = new Link(); $linkres->randkey = strip_tags($_POST['randkey']); if (Submit_Show_URL_Input == false) { $url = "http://"; $linkres->randkey = rand(10000, 10000000); } $Submit_Show_URL_Input = Submit_Show_URL_Input; if ($url == "http://" || $url == "") { $Submit_Show_URL_Input = false; } $main_smarty->assign('randkey', $linkres->randkey); $main_smarty->assign('submit_url', $url); $main_smarty->assign('Submit_Show_URL_Input', $Submit_Show_URL_Input); $main_smarty->assign('Submit_Require_A_URL', Submit_Require_A_URL); $edit = false; $linkres->get($url); $trackback = $linkres->trackback; if ($url == "http://" || $url == "") { if (Submit_Require_A_URL == false) { $linkres->valid = true; } else { $linkres->valid = false; } } if (!$linkres->valid) { $main_smarty->assign('submit_error', 'invalidurl'); $main_smarty->assign('tpl_center', $the_template . '/submit_errors'); define('pagename', 'submit'); $main_smarty->assign('pagename', pagename); $main_smarty->display($the_template . '/pligg.tpl'); return; } if (Submit_Require_A_URL == true || $url != "http://" && $url != "") { if ($linkres->duplicates($url) > 0) { $main_smarty->assign('submit_search', getmyurl("search", htmlentities($url))); $main_smarty->assign('submit_error', 'dupeurl'); $main_smarty->assign('tpl_center', $the_template . '/submit_errors'); define('pagename', 'submit'); $main_smarty->assign('pagename', pagename); $main_smarty->display($the_template . '/pligg.tpl'); return; } } check_actions('submit_validating_url', array("url" => $url)); $linkres->status = 'discard'; $linkres->author = $current_user->user_id; $linkres->store(); $main_smarty->assign('StorySummary_ContentTruncate', StorySummary_ContentTruncate); $main_smarty->assign('SubmitSummary_Allow_Edit', SubmitSummary_Allow_Edit); $main_smarty->assign('enable_tags', Enable_Tags); $main_smarty->assign('submit_url_title', $linkres->url_title); $main_smarty->assign('submit_id', $linkres->id); $main_smarty->assign('submit_type', $linkres->type()); if (isset($link_title)) { $main_smarty->assign('submit_title', $link_title); } if (isset($link_content)) { $main_smarty->assign('submit_content', $link_content); } $main_smarty->assign('submit_trackback', $trackback); $main_smarty->assign('submit_link_field1', $linkres->link_field1); $main_smarty->assign('submit_link_field2', $linkres->link_field2); $main_smarty->assign('submit_link_field3', $linkres->link_field3); $main_smarty->assign('submit_link_field4', $linkres->link_field4); $main_smarty->assign('submit_link_field5', $linkres->link_field5); $main_smarty->assign('submit_link_field6', $linkres->link_field6); $main_smarty->assign('submit_link_field7', $linkres->link_field7); $main_smarty->assign('submit_link_field8', $linkres->link_field8); $main_smarty->assign('submit_link_field9', $linkres->link_field9); $main_smarty->assign('submit_link_field10', $linkres->link_field10); $main_smarty->assign('submit_link_field11', $linkres->link_field11); $main_smarty->assign('submit_link_field12', $linkres->link_field12); $main_smarty->assign('submit_link_field13', $linkres->link_field13); $main_smarty->assign('submit_link_field14', $linkres->link_field14); $main_smarty->assign('submit_link_field15', $linkres->link_field15); $catsql = mysql_query("SELECT category_id, category_name FROM " . table_categories . " WHERE category_lang='{$dblang}' ORDER BY category_name ASC"); $categories = array(); while ($rows = mysql_fetch_array($catsql, MYSQL_ASSOC)) { array_push($categories, $rows); } $main_smarty->assign('categories', $categories); include_once mnminclude . 'dbtree.php'; $array = tree_to_array(0, table_categories, FALSE); $main_smarty->assign('lastspacer', 0); $main_smarty->assign('cat_array', $array); //spellchecker $main_smarty->assign('Spell_Checker', Spell_Checker); $main_smarty->assign('tpl_extra_fields', $the_template . '/submit_extra_fields'); $main_smarty->assign('tpl_center', $the_template . '/submit_step_2'); define('pagename', 'submit'); $main_smarty->assign('pagename', pagename); $main_smarty->display($the_template . '/pligg.tpl'); }