Beispiel #1
0
 if ($Myadmin == 1) {
     $naviObj->conditionE = "";
 } else {
     $naviObj->conditionE = " visibility = '1' AND UNIX_TIMESTAMP(date) < {$timestamp} ";
 }
 $TotalRows = $naviObj->exist();
 $max_pages = ceil($TotalRows / $set[0]["perpage_gallery"]);
 if (is_numeric($page) && $page <= $max_pages) {
     if ($TotalRows > $set[0]["perpage_gallery"]) {
         $naviObj->totalrows = $TotalRows;
         $titleG = $TotalRows . " " . $gal_numbers;
         //$naviObj->title = '';
         $naviObj->showperpage = $set[0]["perpage_gallery"];
         $naviObj->link = ROOT_DIR . "gallery/page/";
         // required
         $save_pages = $naviObj->rowpages($page);
         // global parameter, defined in config.php
     }
     unset($naviObj);
     /******************************************/
     /* Print :: SELECT */
     $gallery->cols = "id, title, title_EN, description, description_EN, folder, date, DATE_FORMAT(date,'%d. %m %Y') as date_formatted, visibility";
     $gallery->table = $tbl_gallery;
     if ($Myadmin == 1) {
         $gallery->condition = '';
     } else {
         $gallery->condition = " visibility = '1' AND UNIX_TIMESTAMP(date) < {$timestamp} ";
     }
     $gallery->order = 'date DESC, id DESC';
     $gallery->limit = $begin . ", " . $set[0]["perpage_gallery"];
     $gallery->module = 'gallery';
Beispiel #2
0
 $comments_exist->conditionE = "bid = '{$id}' AND deleted = '0'";
 $comments_total = $comments_exist->exist();
 /* Generate Pagenavi for comments */
 require_once './lib/pagenavi.php';
 $naviObj = new pagenavi();
 $naviObj->tableE = $tbl_blog_comments;
 // required
 $naviObj->conditionE = "bid = '{$id}' AND deleted = '0'";
 $TotalRows = $comments_total;
 $max_pages = ceil($TotalRows / $set[0]["perpage_comments"]);
 $array_pages_c[$count]['bid'] = $id;
 //if (is_numeric($page) && $page <= $max_pages) {
 if ($TotalRows > $set[0]["perpage_comments"]) {
     $naviObj->totalrows = $TotalRows;
     $naviObj->showperpage = $set[0]["perpage_comments"];
     $array_pages_c[$count]['content'] = $naviObj->rowpages('1');
     // global parameter, defined in config.php
 }
 unset($naviObj);
 //}
 if ($max_pages <= 1) {
     $array_pages_c[$count]['content'] = '';
 }
 $count++;
 /******************************************/
 $toggleS_style = 'none';
 $toggleS_img = 'expand';
 $toggleS_title = $toggle_expandC;
 $toggleA_style = 'none';
 $toggleA_img = 'expand';
 $toggleA_title = $toggle_expand;
Beispiel #3
0
function page($table, $bid, $pageid, $TotalRows)
{
    global $tpl;
    $objResponse = new xajaxResponse();
    include 'settings/config.php';
    include 'settings/tables.php';
    include 'settings/template.php';
    require_once 'lib/select.php';
    require_once 'lib/pagenavi.php';
    if ($table == $tbl_blog_comments) {
        $max_pages = ceil($TotalRows / $set[0]["perpage_comments"]);
        if (is_numeric($pageid) == false) {
            if ($pageid == 'first') {
                $pageid = 1;
            }
            if ($pageid == 'last') {
                $pageid = $max_pages;
            }
        }
        $begin_c = ($pageid - 1) * $set[0]["perpage_comments"];
        /* Print :: SELECT :: Comments */
        $comments = new SelectEntrys();
        $comments->cols = 'id, bid, time, name, comment, lang';
        $comments->table = $tbl_blog_comments;
        $comments->condition = "bid = '{$bid}' AND deleted = '0'";
        $comments->order = "time DESC";
        $comments->limit = "{$begin_c}, " . $set[0]['perpage_comments'];
        $comments->multiSelect = 1;
        //$comments->br          = 1;
        $array_com[] = $comments->row();
        unset($comments);
        /******************************************/
        /* Modify Comment Array */
        foreach ($array_com as $array_com2) {
            for ($b = 0; $b < count($array_com2); $b++) {
                //replace url links
                $array_com2[$b]['comment'] = str_replace("www.", "http://www.", $array_com2[$b]['comment']);
                $array_com2[$b]['comment'] = str_replace("http://http://", "http://", $array_com2[$b]['comment']);
                //$array_com2[$b]['comment'] = preg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" class='postedlink' target='_blank'>\\0</a>", $array_com2[$b]['comment']);
                //avoid layout damage
                $array_com2[$b]['comment'] = wordwrap($array_com2[$b]['comment'], 60, " ", 1);
                //decoding
                $array_com2[$b]['comment'] = utf8_encode($array_com2[$b]['comment']);
                //line breaks
                $array_com2[$b]['comment_unformatted'] = $array_com2[$b]['comment'];
                $array_com2[$b]['comment'] = nl2br($array_com2[$b]['comment']);
            }
            $array_com3[] = $array_com2;
        }
        /******************************************/
        /* Generate Pagenavi for comments */
        $naviObj = new pagenavi();
        $naviObj->tableE = $tbl_blog_comments;
        // required
        $naviObj->conditionE = "bid = '{$bid}' AND deleted = '0'";
        if (is_numeric($pageid) && $pageid <= $max_pages) {
            if ($TotalRows > $set[0]["perpage_comments"]) {
                $naviObj->totalrows = $TotalRows;
                $naviObj->showperpage = $set[0]["perpage_comments"];
                $pages_c = $naviObj->rowpages($pageid);
                // global parameter, defined in config.php
            }
            unset($naviObj);
        }
        if ($TotalRows == $set[0]['perpage_comments']) {
            $p_in = "p_cpages_" . $bid;
            $p_in2 = "p_cpages2_" . $bid;
            $p_out = "p_page_" . $bid;
            $p_out2 = "p_page2_" . $bid;
            $objResponse->remove($p_in);
            $objResponse->remove($p_in2);
            $objResponse->assign($p_out, "innerHTML", '&nbsp;');
            $objResponse->assign($p_out2, "innerHTML", '&nbsp;');
        }
        /******************************************/
        /* Generate output */
        $tpl->assign('array_com', $array_com3);
        $tpl->assign('xajax_bid', $bid);
        $tpl->assign('pages_c', $pages_c);
        $tpl->assign('blog_id', $bid);
        $tpl->assign('com_total', $TotalRows);
        $tpl->assign('page_id', $pageid);
        $tpl->assign('Myadmin', $Myadmin);
        $html = $tpl->fetch("pagenavi_ajax.tpl");
        $html2 = $tpl->fetch("blog/comments_show.tpl");
        $p_name = "p_comments_" . $bid;
        $p_name2 = "p_cpages_" . $bid;
        $p_name3 = "p_cpages2_" . $bid;
        $html4 = $tpl->fetch("blog/comments.tpl");
        $objResponse->assign($p_name, "innerHTML", $html2);
        if ($TotalRows > $set[0]['perpage_comments']) {
            $objResponse->assign($p_name2, "innerHTML", $html);
        }
        if ($TotalRows > $set[0]['perpage_comments']) {
            $objResponse->assign($p_name3, "innerHTML", $html);
        }
        //p_cpages_4
        // $objResponse->remove($p_name2);
        // $objResponse->assign($p_name2,"innerHTML","");
        $bullshit = 0;
        //   if ($TotalRows > $set[0]['perpage_comments'] and $bullshit == 0) { $objResponse->assign($p_name2,"innerHTML",$html5);  $bullshit =1; }
        //if ($TotalRows > $set[0]['perpage_comments']) $objResponse->assign($p_name3,"innerHTML",$html);
        //  $objResponse->assign($p_name,"innerHTML",$html2);
        /******************************************/
    }
    return $objResponse;
}