} } if (isset($_POST['process']) && sanitize($_POST['process'], 3) != '') { if (sanitize($_POST['process'], 3) == 'newcomment') { check_referrer(); $vars = array('user_id' => $link->author, 'link_id' => $link->id); check_actions('comment_subscription', $vars); insert_comment(); } } require_once mnminclude . 'check_behind_proxy.php'; // Set globals $globals['link_id'] = $link->id; $globals['category_id'] = $link->category; $globals['category_name'] = $link->category_name(); $globals['category_url'] = $link->category_safe_name(); $vars = ''; check_actions('story_top', $vars); $main_smarty->assign('link_submitter', $link->username()); // setup breadcrumbs and page title $main_smarty->assign('posttitle', $link->title); $navwhere['text1'] = $globals['category_name']; $navwhere['link1'] = getmyurl('maincategory', $globals['category_url']); $navwhere['text2'] = $link->title; $navwhere['link2'] = getmyurl('storycattitle', $globals['category_url'], urlencode($link->title_url)); $main_smarty->assign('navbar_where', $navwhere); $main_smarty->assign('request_category', $globals['category_url']); $main_smarty->assign('request_category_name', $globals['category_name']); // for the comment form $randkey = rand(1000000, 100000000); $main_smarty->assign('randkey', $randkey);
$link->title = str_replace("á", "a", $link->title); $link->title = str_replace("é", "e", $link->title); $link->title = str_replace("í", "i", $link->title); $link->title = str_replace("ó", "o", $link->title); $link->title = str_replace("ú", "u", $link->title); $link->title = str_replace("ñ", "n", $link->title); $link->title = str_replace("Á", "A", $link->title); $link->title = str_replace("É", "E", $link->title); $link->title = str_replace("Í", "I", $link->title); $link->title = str_replace("Ó", "O", $link->title); $link->title = str_replace("Ú", "U", $link->title); $link->title = str_replace("¿", "", $link->title); $link->title = str_replace("Ñ", "N", $link->title); echo "\t<item>\n"; echo "\t\t<title><![CDATA[" . $title . "]]></title>\n"; echo "\t\t<link>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), urlencode($link->title_url), $link->id) . "</link>\n"; echo "\t\t<comments>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), urlencode($link->title_url), $link->id) . "</comments>\n"; if (!empty($link_date)) { echo "\t\t<pubDate>" . date('D, d M Y H:i:s T', $link->{$link_date}) . "</pubDate>\n"; } else { echo " <pubDate>" . date('D, d M Y H:i:s T', time()) . "</pubDate>\n"; } echo "\t\t<dc:creator>{$link->username}</dc:creator>\n"; echo "\t\t<category>" . htmlspecialchars($category_name) . "</category>\n"; echo "\t\t<guid>" . getmyFullurl("storyURL", $link->category_safe_name($link->category), urlencode($link->title_url), $link->id) . "</guid>\n"; echo "\t\t<description><![CDATA[" . $description . " ]]></description>\n"; // echo " <trackback:ping>".get_trackback($link->id)."</trackback:ping>\n"; // no standard //echo "<content:encoded><![CDATA[ ]]></content:encoded>\n"; echo "\t</item>\n\n"; } }
$stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}"); $link = new Link(); //$user = new User; if ($stories) { foreach ($stories as $dblink) { $link->id = $dblink->link_id; $cached_links[$dblink->link_id] = $dblink; $link->read(); $live_item['link_date'] = txt_time_diff($link->date); $live_item['link_title'] = $link->title; if (Voting_Method == 2) { $live_item['link_votes'] = $link->rating($link->id) / 2; } else { $live_item['link_votes'] = $link->votes; } $live_item['link_username'] = $dblink->user_login; $live_item['link_category'] = GetCatName($link->category); $live_item['link_category_url'] = getmyurl("queuedcategory", $link->category_safe_name()); # $live_item['link_category_url'] = $link->category_safe_name(); $live_item['link_url'] = $link->get_internal_url(); $live_items[] = $live_item; } $main_smarty->assign('live_items', $live_items); } // pagination $main_smarty->assign('live_pagination', do_pages($rows, $top_users_size, "unpublished", true)); // sidebar $main_smarty = do_sidebar($main_smarty); // show the template $main_smarty->assign('tpl_center', $the_template . '/live_unpublished_center'); $main_smarty->display($the_template . '/pligg.tpl');
$authormail = $db->get_var("SELECT user_email FROM ".table_users." WHERE `user_id` = '$link->author';"); $subject= 'there is a new comment in your story'; $message = "bodytext!"; $headers = "From: noreply@pligg.com" . "\r\nReply-To: noreply@pligg.com " . "\r\nX-Priority: 1\r\n"; $to=$authormail; @mail($to, $subject, $message, $headers); }*/ insert_comment(); } } require_once mnminclude . 'check_behind_proxy.php'; // Set globals $globals['link_id'] = $link->id; $globals['category_id'] = $link->category; $globals['category_name'] = $link->category_name(); $globals['category_url'] = $link->category_safe_name(); $vars = ''; check_actions('story_top', $vars); $main_smarty->assign('link_submitter', $link->username()); // setup breadcrumbs and page title $main_smarty->assign('posttitle', " - " . $link->title); $navwhere['text1'] = $globals['category_name']; $navwhere['link1'] = getmyurl('maincategory', $globals['category_url']); $navwhere['text2'] = $link->title; $navwhere['link2'] = getmyurl('storycattitle', $globals['category_url'], urlencode($link->title_url)); $main_smarty->assign('navbar_where', $navwhere); // for the comment form $randkey = rand(1000000, 100000000); $main_smarty->assign('randkey', $randkey); $main_smarty->assign('link_id', $link->id); $main_smarty->assign('user_id', $current_user->user_id);
} if (isset($_REQUEST['title'])) { $requestTitle = strip_tags($_REQUEST['title']); } // if we're using "Friendly URL's for categories" if (isset($_REQUEST['category'])) { $thecat = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE `category_safe_name` = '" . strip_tags($_REQUEST['category']) . "';"); } if (isset($requestID) && enable_friendly_urls == true) { // if we're using friendly urls, don't all /story.php?id=XX or /story/XX/ // this is to prevent google from thinking it's spam // more work needs to be done on this $link = new Link(); $link->id = $requestID; $link->read(); $url = getmyurl("storyURL", $link->category_safe_name($link->category), urlencode($link->title_url), $link->id); Header("HTTP/1.1 301 Moved Permanently"); Header("Location: " . $url); die; } // if we're using "Friendly URL's for stories" if (isset($requestTitle)) { $requestID = $db->get_var("SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '{$requestTitle}';"); } if (is_numeric($requestID)) { $id = $requestID; $link = new Link(); $link->id = $requestID; $link->read(); if (isset($_POST['process'])) { if ($_POST['process'] == 'newcomment') {
$rows = $db->get_var("SELECT count(*) as count {$from_where} {$order_by}"); $stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}"); $link = new Link(); //$user = new User; if ($stories) { foreach ($stories as $story) { $link->id = $story->link_id; $cached_links[$story->link_id] = $story; $link->read(); $live_item['link_date'] = txt_time_diff($link->published_date); $live_item['link_title'] = $link->title; if (Voting_Method == 2) { $live_item['link_votes'] = $link->votes / 2; } else { $live_item['link_votes'] = $link->votes; } $live_item['link_username'] = $story->user_login; $live_item['link_category'] = GetCatName($link->category); $live_item['link_category_url'] = $link->category_safe_name(); $live_item['link_url'] = $link->get_internal_url(); $live_items[] = $live_item; } $main_smarty->assign('live_items', $live_items); } // pagination $main_smarty->assign('live_pagination', do_pages($rows, $top_users_size, "published", true)); // sidebar $main_smarty = do_sidebar($main_smarty); // show the template $main_smarty->assign('tpl_center', $the_template . '/live_published_center'); $main_smarty->display($the_template . '/pligg.tpl');
function create_sitemap($index, $max_rec) { global $db, $my_base_url, $my_pligg_base; if (XmlSitemaps_use_cache) { $icf = "cache/sitemap-{$index}.xml"; if (file_exists($icf) && ($s = stat($icf)) && time() - $s['mtime'] < XmlSitemaps_cache_ttl) { echo my_file_get_contents($icf); return true; } ob_start(); } echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"; $sql = "SELECT l.link_id FROM (select link_id,link_modified from " . table_links . " WHERE link_status!='discard' order by link_modified asc LIMIT " . $index * $max_rec . "," . $max_rec . ") l order by l.link_modified desc"; $link = new Link(); $links = $db->get_col($sql); if ($index != 0) { $did_mainpage = 1; } else { $did_mainpage = 0; } if ($links) { foreach ($links as $link_id) { $link->id = $link_id; $link->read(); //print_r($link); //return ; $freq = freq_calc($link->modified); echo "<url>\n"; echo "<loc>" . getmyFullurl("storyURL", urlencode($link->category_safe_name($link->category)), urlencode($link->title_url), $link->id) . "</loc>\n"; //c / v * 30 + vo /v * 10 + ( 100 / acum-mod ) * 60 $v = (time() - $link->date) / 60; $pri = max(0.0001, ($link->comments / $v * 30 + $link->votes * 10 / $v + 100 / max(100, time() - $link->modified) * 60) / 100); echo "<lastmod>"; echo my_format_date($link->modified); echo "</lastmod>\n"; echo "<changefreq>{$freq}</changefreq>\n"; echo "<priority>" . $pri . "</priority>\n"; echo "</url>\n"; } } echo '</urlset>'; if (XmlSitemaps_use_cache) { $ret = ob_get_contents(); ob_end_flush(); my_file_put_contents($icf, $ret); } return true; }
function create_sitemap_links($index, $max_rec) { global $db; if (sitemap_header($index)) { return true; } $sql = "SELECT link_id FROM " . table_links . " WHERE link_status='new' OR link_status='published' ORDER BY link_modified DESC LIMIT " . $index * $max_rec . ",{$max_rec}"; $link = new Link(); $links = $db->get_col($sql); if ($links) { foreach ($links as $link_id) { $link->id = $link_id; $link->read(); $freq = freq_calc($link->modified); echo "<url>\n"; echo "<loc>" . getmyFullurl("storyURL", urlencode($link->category_safe_name($link->category)), urlencode($link->title_url), $link->id) . "</loc>\n"; //c / v * 30 + vo /v * 10 + ( 100 / acum-mod ) * 60 $v = (time() - $link->date) / 60; $pri = max(0.0001, ($link->comments / $v * 30 + $link->votes * 10 / $v + 100 / max(100, time() - $link->modified) * 60) / 100); echo "<lastmod>"; echo my_format_date($link->modified); echo "</lastmod>\n"; echo "<changefreq>{$freq}</changefreq>\n"; echo "<priority>" . $pri . "</priority>\n"; echo "</url>\n"; } } sitemap_footer($index); }