예제 #1
0
파일: links.php 프로젝트: notzen/e107
    displayTopRefer();
}
//personal link managers
if (isset($qs[0]) && $qs[0] == "manage") {
    echo displayNavigator('');
    displayPersonalManager();
}
//comments on links
if (isset($qs[0]) && $qs[0] == "comment" && isset($qs[1]) && is_numeric($qs[1])) {
    echo displayNavigator('');
    displayLinkComment();
}
//submit link
if (isset($qs[0]) && $qs[0] == "submit") {
    if (check_class($linkspage_pref['link_submit_class'])) {
        echo displayNavigator('');
        displayLinkSubmit();
    } else {
        $lc->show_message(LAN_LINKS_50);
    }
}
function displayTopRated()
{
    global $qs, $sql, $lc, $tp, $rowl, $link_shortcodes, $from, $ns, $linkspage_pref;
    global $LINK_RATED_TABLE_START, $LINK_RATED_TABLE, $LINK_RATED_TABLE_END, $LINK_RATED_RATING, $LINK_RATED_APPEND;
    $number = isset($linkspage_pref["link_nextprev_number"]) && $linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20";
    $np = $linkspage_pref["link_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : "";
    $catrate = isset($qs[1]) && is_numeric($qs[1]) ? " AND l.link_category='" . $qs[1] . "' " : "";
    $ratemin = isset($linkspage_pref['link_rating_minimum']) && $linkspage_pref['link_rating_minimum'] ? $linkspage_pref['link_rating_minimum'] : "0";
    $qry = "\n\tSELECT l.*, r.*, lc.link_category_id, lc.link_category_name, (r.rate_rating / r.rate_votes) as rate_avg\n\tFROM #rate AS r\n\tLEFT JOIN #links_page AS l ON l.link_id = r.rate_itemid\n\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\tWHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' " . $catrate . " AND lc.link_category_class REGEXP '" . e_CLASS_REGEXP . "' AND r.rate_table='links_page'\n\tORDER BY rate_avg DESC\n\t";
    $qry2 = $qry . " " . $np;
예제 #2
0
function displayCategoryLinks($mode = '')
{
    global $lc, $cobj, $rowl, $qs, $linkspage_pref, $from, $link_shortcodes, $link_category_total;
    global $linkbutton_count, $link_category_total, $LINK_APPEND;
    $db2 = e107::getDb('sql2');
    $tp = e107::getParser();
    $mes = e107::getMessage();
    $template = e107::getTemplate('links_page', 'links_page');
    $order = $lc->getOrder();
    $number = $linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20";
    $nextprevquery = $mode && $linkspage_pref["link_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : "";
    $cat = $mode ? " AND l.link_category='" . intval($mode) . "' " : "";
    $qry = "\n\tSELECT l.*, lc.*, COUNT(c.comment_id) AS link_comment\n\tFROM #links_page AS l\n\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\tLEFT JOIN #comments as c ON c.comment_item_id=l.link_id AND comment_type='links_page'\n\tWHERE l.link_active = 1 AND l.link_class REGEXP '" . e_CLASS_REGEXP . "' AND lc.link_category_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . "\n\tGROUP BY l.link_id\n\t" . $order . "\n\t" . $nextprevquery . "\n\t";
    $link_table_string = "";
    $link_total = $db2->count("links_page as l", "(*)", "WHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . " ");
    if (!$db2->gen($qry)) {
        $navigator = displayNavigator();
        $navigator .= displaySortOrder();
        $var = array('ERROR_MESSAGE' => LAN_LINKS_34);
        $error = $tp->simpleParse($template['LINK_ERROR_MESSAGE'], $var);
        $text = $navigator . $error;
        e107::getRender()->tablerender(LAN_LINKS_39, $text);
    } else {
        $linkbutton_count = 0;
        $list = $db2->rows();
        foreach ($list as $rowl) {
            $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count;
            if ($mode) {
                $cat_name = $rowl['link_category_name'];
                $cat_desc = $rowl['link_category_description'];
                $LINK_APPEND = $lc->parse_link_append($rowl);
                $link_table_string .= $tp->parseTemplate($template['LINK_TABLE'], FALSE, $link_shortcodes);
            } else {
                $arr[$rowl['link_category_id']][] = $rowl;
            }
        }
        if ($mode) {
            $link_category_total = $link_total;
            $link_table_start = $tp->parseTemplate($template['LINK_TABLE_START'], FALSE, $link_shortcodes);
            $link_table_end = $tp->parseTemplate($template['LINK_TABLE_END'], FALSE, $link_shortcodes);
            $text = $link_table_start . $link_table_string . $link_table_end;
            $caption = LAN_LINKS_32 . " " . $cat_name . " " . ($cat_desc ? " <i>[" . $cat_desc . "]</i>" : "");
            //number of links
            $caption .= " (<b title='" . (ADMIN ? LAN_LINKS_2 : LAN_LINKS_1) . "' >" . $link_total . "</b>" . (ADMIN ? "/<b title='" . (ADMIN ? LAN_LINKS_1 : "") . "' >" . $link_total . "</b>" : "") . ") ";
            $navigator = displayNavigator('cat');
            $navigator .= displaySortOrder('cat');
            $text = $navigator . $text;
            if (is_numeric($mode)) {
                $pagination = $lc->ShowNextPrev($from, $number, $link_total);
                $text = $text . $pagination;
            }
            e107::getRender()->tablerender($caption, $text);
        } else {
            $text = '';
            foreach ($arr as $key => $value) {
                $link_table_string = "";
                $linkbutton_count = 0;
                $i = 0;
                for ($i = 0; $i < count($value); $i++) {
                    $rowl = $value[$i];
                    $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count;
                    $cat_name = $rowl['link_category_name'];
                    $cat_desc = $rowl['link_category_description'];
                    $LINK_APPEND = $lc->parse_link_append($rowl);
                    $link_table_string .= $tp->parseTemplate($template['LINK_TABLE'], FALSE, $link_shortcodes);
                }
                $link_category_total = count($value);
                $link_table_caption = $tp->parseTemplate($template['LINK_TABLE_CAPTION'], FALSE, $link_shortcodes);
                $link_table_start = $tp->parseTemplate($template['LINK_TABLE_START'], FALSE, $link_shortcodes);
                $link_table_end = $tp->parseTemplate($template['LINK_TABLE_END'], FALSE, $link_shortcodes);
                $text .= $link_table_start . $link_table_string . $link_table_end;
            }
            $navigator = displayNavigator();
            $navigator .= displaySortOrder();
            $text = $navigator . $text;
            e107::getRender()->tablerender($link_table_caption, $text);
        }
    }
    return;
}
예제 #3
0
 function sc_navigator($parm = '')
 {
     return displayNavigator('');
 }