index.php
For the code
// find the name of the current category
if(isset($_REQUEST['category'])){
$thecat = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));
$thecat = $thecat->category_name;
if (!$thecat)
{
$main_smarty->assign('tpl_center', '404error');
$main_smarty->display($the_template . '/pligg.tpl');
die();
}
}
// start a new search
$search=new Search();
// check for some get/post
if(isset($_REQUEST['from'])){
$search->newerthan = sanitize($_REQUEST['from'], 3);
}
unset($_REQUEST['search']);
unset($_POST['search']);
unset($_GET['search']);
if(isset($_REQUEST['search'])){$search->searchTerm = sanitize($_REQUEST['search'], 3);}
if(isset($_REQUEST['search'])){$search->filterToStatus = "all";}
if(!isset($_REQUEST['search'])){$search->orderBy = "link_published_date DESC";}
if(isset($_REQUEST['tag'])){$search->searchTerm = sanitize($_REQUEST['search'], 3); $search->isTag = true;}
if(isset($thecat)){
$search->category = $thecat;
}
// figure out what "page" of the results we're on
$search->offset = (get_current_page()-1)*$page_size;
// pagesize set in the admin panel
$search->pagesize = $page_size;
// since this is index, we only want to view "published" stories
$search->filterToStatus = "published";
// this is for the tabs on the top that filter
if(isset($_GET['part'])){$search->setmek = $db->escape($_GET['part']);}
$search->do_setmek();
// do the search
$search->doSearch();
$linksum_count = $search->countsql;
$linksum_sql = $search->sql;
Alter to
// find the name of the current category
if(isset($_REQUEST['category'])){
$thecat = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1));
$thecat = $thecat->category_name;
if (!$thecat)
{
$main_smarty->assign('tpl_center', '404error');
$main_smarty->display($the_template . '/pligg.tpl');
die();
}
}elseif(!isset($_REQUEST['category'])){
$catnameopinion = opinion;
if(isset($catnameopinion)){
$thecatopinion = get_cached_category_data('category_safe_name', sanitize($catnameopinion, 1));
$thecatopinion = $thecatopinion->category_name;
if (!$thecatopinion)
{
$main_smarty->assign('tpl_center', '404error');
$main_smarty->display($the_template . '/pligg.tpl');
die();
}
}
}
// start a new search
$search=new Search();
$search2=new Search();
// check for some get/post
if(isset($_REQUEST['from'])){
$search->newerthan = sanitize($_REQUEST['from'], 3);
$search2->newerthan = sanitize($_REQUEST['from'], 3);
}
unset($_REQUEST['search']);
unset($_POST['search']);
unset($_GET['search']);
if(isset($_REQUEST['search'])){$search->searchTerm = sanitize($_REQUEST['search'], 3);
$search2->searchTerm = sanitize($_REQUEST['search'], 3);}
if(isset($_REQUEST['search'])){$search->filterToStatus = "all";
$search2->filterToStatus = "all";}
if(!isset($_REQUEST['search'])){$search->orderBy = "link_published_date DESC";
$search2->orderBy = "link_published_date DESC";}
if(isset($_REQUEST['tag'])){$search->searchTerm = sanitize($_REQUEST['search'], 3); $search->isTag = true;
$search2->searchTerm = sanitize($_REQUEST['search'], 3); $search2->isTag = true;}
if(isset($thecat)){
$search->category = $thecat;
}
if(isset($thecatopinion)){
$search2->category = $thecatopinion;
}
// figure out what "page" of the results we're on
$search->offset = (get_current_page()-1)*$page_size;
$search2->offset = (get_current_page()-1)*$page_size;
// pagesize set in the admin panel
$search->pagesize = $page_size;
$search2->pagesize = $page_size;
// since this is index, we only want to view "published" stories
$search->filterToStatus = "published";
$search2->filterToStatus = "published";
// this is for the tabs on the top that filter
if(isset($_GET['part'])){$search->setmek = $db->escape($_GET['part']);
$search2->setmek = $db->escape($_GET['part']);}
$search->do_setmek();
$search2->do_setmek();
// do the search
$search->doSearch();
$search2->doSearch();
$linksum_count = $search->countsql;
$linksum_sql = $search->sql;
$linksum_count_opinion = $search2->countsql;
$linksum_sql_opinion = $search2->sql;
And for
// misc smarty
if(isset($from_text)){$main_smarty->assign('from_text', $from_text);}
if(isset($search->setmek)){$main_smarty->assign('setmeka', $search->setmek);}else{$main_smarty->assign('setmeka', '');}
to
// misc smarty
if(isset($from_text)){$main_smarty->assign('from_text', $from_text);}
if(isset($search->setmek)){$main_smarty->assign('setmeka', $search->setmek);
$main_smarty->assign('setmeka', $search2->setmek);}else{$main_smarty->assign('setmeka', '');}
libs/link_summery.php
at the top of the page, add
if($ls_debug == true){echo '
' . sanitize($rows,3) . '
';}
$links = $db->get_col($linksum_sql);
$the_results = $links;
$links_opinion = $db->get_col($linksum_sql_opinion);
$the_results_opinion = $links_opinion;
And at the bottom of the page, for
if ($links) {
foreach($links as $link_id) {
$link->id=$link_id;
$link->read();
$link_summary_output .= $link->print_summary('summary', true);
$news_link_summary_output .= $link-> print_news_summary('summary', true);
$opinion_link_summary_output .= $link-> print_opinion_summary('summary', true);
}
}
alter to
if ($links || $links_opinion) {
foreach($links as $link_id) {
$link->id=$link_id;
$link->read();
$link_summary_output .= $link->print_summary('summary', true);
$news_link_summary_output .= $link-> print_news_summary('summary', true);
}
foreach($links_opinion as $link_id) {
$link->id=$link_id;
$link->read();
$opinion_link_summary_output .= $link-> print_opinion_summary('summary', true);
}
}
No comments:
Post a Comment