Exemple #1
0
 function getCommentsCount()
 {
     global $xoopsDB, $HTTP_POST_VARS, $HTTP_GET_VARS, $xoopsConfig, $xoopsModule;
     $count = xoops_comment_count($xoopsModule->getVar('mid'), $this->articleid);
     return $count;
 }
 function xcomments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off', $echo = true)
 {
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname(wp_mod());
     $mid = $module->getVar('mid');
     $number = xoops_comment_count($mid, $GLOBALS['wp_post_id']);
     $xcomments_popup_link = "";
     if (0 == $number && 'closed' == $GLOBALS['post']->comment_status) {
         return _echo($none, $echo);
     } else {
         if (!empty($GLOBALS['post']->post_password)) {
             // if there's a password
             if ($_COOKIE['wp-postpass_' . $GLOBALS['cookiehash']] != $GLOBALS['post']->post_password) {
                 // and it doesn't match the cookie
                 return _echo("Enter your password to view comments", $echo);
             }
         }
         $xcomments_popup_link .= '<a href="';
         if (!empty($GLOBALS['wpcommentsjavascript'])) {
             $xcomments_popup_link .= wp_siteurl() . '/' . $GLOBALS['wpcommentspopupfile'] . '?p=' . $GLOBALS['wp_post_id'] . '&amp;c=1';
             $xcomments_popup_link .= '" onclick="wpopen(this.href); return false"';
         } else {
             // if comments_popup_script() is not in the template, display simple comment link
             $xcomments_popup_link .= xcomments_link('', false);
             $xcomments_popup_link .= '"';
         }
         if (!empty($CSSclass)) {
             $xcomments_popup_link .= ' class="' . $CSSclass . '"';
         }
         $xcomments_popup_link .= '>';
         $xcomments_popup_link .= comments_number($zero, $one, $more, $number, false);
         $xcomments_popup_link .= '</a>';
         return _echo($xcomments_popup_link, $echo);
     }
 }
Exemple #3
0
 if ($refmainpage) {
     if (is_object($xoopsUser)) {
         $mainp['ref'] = $refmainpage;
         $xoopsTpl->assign('lang_linktous', $titlelink);
     } else {
         if ($xoopsModuleConfig['anonrefer']) {
             $mainp['ref'] = $refmainpage;
             $xoopsTpl->assign('lang_referfriend', $refertitle);
         }
     }
 }
 $xoopsTpl->assign('totalcount', $total);
 $xoopsTpl->assign('mainp', $mainp);
 // get comments count
 $mod_id = $xoopsModule->getVar('mid');
 $count = xoops_comment_count($mod_id, '');
 // get module permissions
 $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
 $gperm_handler =& xoops_gethandler('groupperm');
 while ($query_data = $xoopsDB->fetcharray($result2)) {
     if ($gperm_handler->checkRight('Channel Permissions', $query_data['CID'], $groups, $xoopsModule->getVar('mid'))) {
         $chanlink['id'] = $query_data['CID'];
         if (!empty($query_data['pageheadline'])) {
             $chanlink['pagetitle'] = $myts->displayTarea($query_data['pageheadline']);
         } else {
             $chanlink['pagetitle'] = $myts->displayTarea($query_data['pagetitle']);
         }
         $xoopsTpl->append('chanlink', $chanlink);
     }
 }
 $xoopsTpl->assign('lang_more', _MD_ALSOSEE);
Exemple #4
0
function get_cat_list(&$breadcrumb, &$cat_data, &$statistics)
{
    global $_GET, $xoopsModuleConfig, $ALBUM_SET, $CURRENT_CAT_NAME, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST;
    global $HIDE_USER_CAT;
    global $xoopsDB, $xoopsModule;
    $cat = isset($_GET['cat']) ? (int) $_GET['cat'] : 0;
    // Build the breadcrumb
    breadcrumb($cat, $breadcrumb, $BREADCRUMB_TEXT);
    // Build the category list
    $cat_data = array();
    $album_set_array = array();
    get_subcat_data($cat, $cat_data, $album_set_array, $xoopsModuleConfig['subcat_level']);
    // Treat the album set
    if ($cat) {
        if ($cat == USER_GAL_CAT) {
            $result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE category >= " . FIRST_USER_CAT);
        } else {
            $result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE category = '{$cat}'");
        }
        while ($row = $xoopsDB->fetchArray($result)) {
            $album_set_array[] = $row['aid'];
        }
        // while
        $xoopsDB->freeRecordSet($result);
    }
    if (count($album_set_array) && $cat) {
        $set = '';
        foreach ($album_set_array as $album) {
            $set .= $album . ',';
        }
        $set = substr($set, 0, -1);
        $current_album_set = "AND aid IN ({$set}) ";
        $ALBUM_SET .= $current_album_set;
    } elseif ($cat) {
        $current_album_set = "AND aid IN (-1) ";
        $ALBUM_SET .= $current_album_set;
    }
    // Gather gallery statistics
    if ($cat == 0) {
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE 1");
        $album_count = $xoopsDB->getRowsNum($result);
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 AND approved='YES'");
        $picture_count = $xoopsDB->getRowsNum($result);
        $xoopsDB->freeRecordSet($result);
        $comment_count = xoops_comment_count($xoopsModule->mid());
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_categories") . " WHERE 1");
        $cat_count = $xoopsDB->getRowsNum($result) - $HIDE_USER_CAT;
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT sum(hits) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1");
        $nbEnr = $xoopsDB->fetchArray($result);
        $hit_count = (int) $nbEnr['sum(hits)'];
        $xoopsDB->freeRecordSet($result);
        if (count($cat_data)) {
            $statistics = strtr(_MD_INDEX_STAT1, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[cat]' => $cat_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        } else {
            $STATS_IN_ALB_LIST = true;
            $statistics = strtr(_MD_INDEX_STAT3, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        }
    } elseif ($cat >= FIRST_USER_CAT && $ALBUM_SET) {
        $result = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $album_count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $picture_count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT sum(hits) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $hit_count = (int) $nbEnr['sum(hits)'];
        $xoopsDB->freeRecordSet($result);
        $statistics = strtr(_MD_INDEX_STAT2, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[views]' => $hit_count));
    } else {
        $statistics = '';
    }
}
function get_pic_data($album, &$count, &$album_name, $limit1 = -1, $limit2 = -1, $set_caption = true)
{
    global $USER, $xoopsModuleConfig, $ALBUM_SET, $CURRENT_CAT_NAME, $HTML_SUBST, $THEME_DIR;
    global $GLOBALS;
    global $xoopsDB, $xoopsModule, $xoopsConfig;
    $myts =& MyTextSanitizer::getInstance();
    // MyTextSanitizer object
    $sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'da' => 'pid ASC', 'dd' => 'pid DESC');
    $sort_code = isset($USER['sort']) ? $USER['sort'] : $xoopsModuleConfig['default_sort_order'];
    $sort_order = isset($sort_array[$sort_code]) ? $sort_array[$sort_code] : $sort_array[$xoopsModuleConfig['default_sort_order']];
    $limit = $limit1 != -1 ? ' LIMIT ' . $limit1 : '';
    $limit .= $limit2 != -1 ? ' ,' . $limit2 : '';
    if ($limit2 == 1) {
        $select_columns = '*';
    } else {
        $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime';
    }
    // Regular albums
    if (is_numeric($album)) {
        $album_name = get_album_name($album);
        $approved = GALLERY_ADMIN_MODE ? '' : 'AND approved=\'YES\'';
        $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        if ($select_columns != '*') {
            $select_columns .= ', title, caption, owner_id';
        }
        $result = $xoopsDB->query("SELECT {$select_columns} from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE aid='{$album}' {$approved} {$ALBUM_SET} ORDER BY {$sort_order} {$limit}");
        $rowset = db_fetch_rowset($result);
        $xoopsDB->freeRecordSet($result);
        // Set picture caption
        if ($set_caption) {
            foreach ($rowset as $key => $row) {
                $caption = $rowset[$key]['title'] ? "<span class=\"thumb_title\">" . $rowset[$key]['title'] . "</span>" : '';
                if ($xoopsModuleConfig['caption_in_thumbview']) {
                    $caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">" . $myts->makeTareaData4Show($rowset[$key]['caption'], 0) . "</span>" : '';
                }
                if ($xoopsModuleConfig['display_comment_count']) {
                    $comments_nr = xoops_comment_count($xoopsModule->mid(), $row['pid']);
                    if ($comments_nr > 0) {
                        $caption .= "<span class=\"thumb_num_comments\">" . sprintf(_MD_FUNC_COM, $comments_nr) . "</span>";
                    }
                }
                $rowset[$key]['caption_text'] = $caption;
            }
        }
        return $rowset;
    }
    // Meta albums
    switch ($album) {
        case 'lastcom':
            // Last comments
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = $album_name = _MD_LASTCOM . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTCOM;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved='YES' AND com_itemid = pid {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns = $select_columns . ', com_id, com_uid,com_itemid,com_rootid, com_exparams, com_created, com_title';
            }
            include_once XOOPS_ROOT_PATH . "/include/comment_constants.php";
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xoopscomments") . ", " . $xoopsDB->prefix("xcgal_pictures") . " WHERE com_modid = " . $xoopsModule->mid() . " AND approved = 'YES' AND pid = com_itemid AND com_status=" . XOOPS_COMMENT_ACTIVE . " {$ALBUM_SET} ORDER by com_id DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            $member_handler =& xoops_gethandler('member');
            $comment_config = $xoopsModule->getInfo('comments');
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    if ($row['com_uid'] > 0) {
                        $poster =& $member_handler->getUser($row['com_uid']);
                        if (is_object($poster)) {
                            $posters = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $row['com_uid'] . '">' . $poster->getVar('uname') . '</a>';
                        } else {
                            $posters = $GLOBALS['xoopsConfig']['anonymous'];
                        }
                    } else {
                        $posters = $GLOBALS['xoopsConfig']['anonymous'];
                    }
                    $comtitle = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/' . $comment_config['pageName'] . '?' . $comment_config['itemName'] . '=' . $row['com_itemid'] . '&amp;com_id=' . $row['com_id'] . '&amp;com_rootid=' . $row['com_rootid'] . '&amp;com_mode=flat&amp;' . $row['com_exparams'] . '#comment' . $row['com_id'] . '">' . $row['com_title'] . '</a>';
                    $caption = "<span class=\"thumb_title\">" . $posters . '</span>' . "<span class=\"thumb_caption\">" . formatTimestamp($row['com_created'], 'm') . '</span>' . "<span class=\"thumb_caption\">" . $comtitle . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'lastup':
            // Last uploads
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_LASTUP . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTUP;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', owner_id';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY pid DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $user_handler =& xoops_gethandler('member');
                    $pic_owner =& $user_handler->getUser($row['owner_id']);
                    if (is_object($pic_owner)) {
                        $user_link = '<br /><a href ="' . XOOPS_URL . '/userinfo.php?uid=' . $pic_owner->uid() . '">' . $pic_owner->uname() . '</a>';
                    } else {
                        $user_link = '';
                    }
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['ctime'], 'm') . $user_link . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'topn':
            // Most viewed pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_TOPN . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_TOPN;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND hits > 0  {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', hits';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND hits > 0 {$ALBUM_SET} ORDER BY hits DESC, ctime, mtime {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . sprintf(_MD_FUNC_VIEW, $row['hits']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'toprated':
            // Top rated pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_TOPRATED . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_TOPRATED;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND votes >= '{$xoopsModuleConfig['min_votes_for_rating']}' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', pic_rating, votes';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND votes >= '{$xoopsModuleConfig['min_votes_for_rating']}' {$ALBUM_SET} ORDER BY ROUND((pic_rating+1)/2000) DESC, votes DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    if (defined('THEME_HAS_RATING_GRAPHICS')) {
                        $prefix = $THEME_DIR;
                    } else {
                        $prefix = '';
                    }
                    $caption = "<span class=\"thumb_caption\">" . '<img src="' . $prefix . 'images/rating' . round($row['pic_rating'] / 2000) . '.gif" align="middle" alt=""/>' . '<br />' . sprintf(_MD_FUNC_VOTE, $row['votes']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'lasthits':
            // Last viewed pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_LASTHITS . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_LASTHITS;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', mtime';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY mtime DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['mtime'], 'm') . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'random':
            // Random pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_RANDOM . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_RANDOM;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $pic_count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            // if we have more than 1000 pictures, we limit the number of picture returned
            // by the SELECT statement as ORDER BY RAND() is time consuming
            if ($pic_count > 1000) {
                $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES'");
                $nbEnr = $xoopsDB->fetchArray($result);
                $total_count = $nbEnr['count(*)'];
                $xoopsDB->freeRecordSet($result);
                $granularity = floor($total_count / RANDPOS_MAX_PIC);
                $cor_gran = ceil($total_count / $pic_count);
                srand(time());
                for ($i = 1; $i <= $cor_gran; $i++) {
                    $random_num_set = rand(0, $granularity) . ', ';
                }
                $random_num_set = substr($random_num_set, 0, -2);
                $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE  randpos IN ({$random_num_set}) AND approved = 'YES' {$ALBUM_SET} ORDER BY RAND() LIMIT {$limit2}");
            } else {
                $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' {$ALBUM_SET} ORDER BY RAND() LIMIT {$limit2}");
            }
            $rowset = array();
            while ($row = $xoopsDB->fetchArray($result)) {
                $row['caption_text'] = '';
                $rowset[-$row['pid']] = $row;
            }
            $xoopsDB->freeRecordSet($result);
            return $rowset;
            break;
        case 'search':
            // Search results
            if (isset($USER['search'])) {
                $search_string = $USER['search'];
            } else {
                $search_string = '';
            }
            if (substr($search_string, 0, 3) == '###') {
                $query_all = 1;
                $search_string = substr($search_string, 3);
            } else {
                $query_all = 0;
            }
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_SEARCH . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_SEARCH . ' - "' . $search_string . '"';
            }
            //var_dump(htmlspecialchars($search_string));
            //$search_string = utf8Encode($search_string);
            include 'include/search.inc.php';
            return $rowset;
            break;
        case 'usearch':
            // User pics search results
            if (isset($USER['suid']) && $USER['suid'] > 0) {
                $owner = new XoopsUser($USER['suid']);
                $album_name = _MD_USEARCH . $owner->uname();
            } else {
                $album_name = 'Pics submitted by ' . $xoopsConfig['anonymous'];
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND owner_id = '{$USER['suid']}' {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', pic_rating, votes';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND owner_id = '{$USER['suid']}' {$ALBUM_SET} ORDER BY ctime DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . formatTimestamp($row['ctime'], 'm') . "</span>";
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        case 'mostsend':
            // Top rated pictures
            if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                $album_name = _MD_MOST_SENT . ' - ' . $CURRENT_CAT_NAME;
            } else {
                $album_name = _MD_MOST_SENT;
            }
            $result = $xoopsDB->query("SELECT count(*) from " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND sent_card > 0 {$ALBUM_SET}");
            $nbEnr = $xoopsDB->fetchArray($result);
            $count = $nbEnr['count(*)'];
            $xoopsDB->freeRecordSet($result);
            if ($select_columns != '*') {
                $select_columns .= ', sent_card';
            }
            $result = $xoopsDB->query("SELECT {$select_columns} FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE approved = 'YES' AND sent_card >0 {$ALBUM_SET} ORDER BY sent_card DESC {$limit}");
            $rowset = db_fetch_rowset($result);
            $xoopsDB->freeRecordSet($result);
            if ($set_caption) {
                foreach ($rowset as $key => $row) {
                    $caption = "<span class=\"thumb_caption\">" . sprintf(_MD_FUNC_SEND, $row['sent_card']) . '</span>';
                    $rowset[$key]['caption_text'] = $caption;
                }
            }
            return $rowset;
            break;
        default:
            // Invalid meta album
            redirect_header('index.php', 2, _MD_NON_EXIST_AP);
    }
}
function xcomments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off')
{
    global $wp_post_id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash, $wp_id;
    global $siteurl, $xoopsDB, $xoopsModule, $wp_mod;
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname($wp_mod[$wp_id]);
    $mid = $module->getVar('mid');
    $number = xoops_comment_count($mid, $wp_post_id);
    if (0 == $number && 'closed' == $post->comment_status) {
        echo $none;
        return;
    } else {
        if (!empty($post->post_password)) {
            // if there's a password
            if ($_COOKIE['wp-postpass_' . $cookiehash] != $post->post_password) {
                // and it doesn't match the cookie
                echo "Enter your password to view comments";
                return;
            }
        }
        echo '<a href="';
        if ($wpcommentsjavascript) {
            echo $siteurl . '/' . $wpcommentspopupfile . '?p=' . $wp_post_id . '&amp;c=1';
            //echo get_permalink();
            echo '" onclick="wpopen(this.href); return false"';
        } else {
            // if comments_popup_script() is not in the template, display simple comment link
            xcomments_link();
            echo '"';
        }
        if (!empty($CSSclass)) {
            echo ' class="' . $CSSclass . '"';
        }
        echo '>';
        comments_number($zero, $one, $more, $number);
        echo '</a>';
    }
}