예제 #1
0
******************************************************/
if (!defined('CPG_NUKE')) {
    exit;
}
global $db, $prefix;
$dl_mod = 'Downloads';
require_once 'modules/' . $dl_mod . '/functions/info.inc';
$dl_mod_prefix = $prefix . '_' . strtolower($dl_mod);
$content = '';
if (!is_active($dl_mod)) {
    $content = 'ERROR';
    return trigger_error($dl_mod . ' module is inactive', E_USER_WARNING);
}
list($total_cats) = $db->sql_ufetchrow("SELECT count(*) FROM " . $dl_mod_prefix . "_categories", SQL_NUM, __FILE__, __LINE__);
list($total_dl, $total_filesize) = $db->sql_ufetchrow("SELECT count(*), sum(filesize) FROM " . $dl_mod_prefix . "_downloads", SQL_NUM, __FILE__, __LINE__);
list($total_hits, $total_views) = $db->sql_ufetchrow("SELECT sum(hits), sum(views) FROM " . $dl_mod_prefix . "_stats", SQL_NUM, __FILE__, __LINE__);
list($total_votes, $sum_votes) = $db->sql_ufetchrow("SELECT count(*), sum(score) FROM " . $dl_mod_prefix . "_ratings", SQL_NUM, __FILE__, __LINE__);
$avg_score = $total_votes > 0 ? $sum_votes / $total_votes : 0;
$content = '
<b>&#8226;</b>&nbsp;Categories: ' . $total_cats . '<br />
<b>&#8226;</b>&nbsp;Downloads: ' . $total_dl . '<br />
&nbsp;&nbsp;<strong><big>&middot;</big></strong> Hits: ' . $total_hits . '<br />
&nbsp;&nbsp;<strong><big>&middot;</big></strong> Views: ' . $total_views . '<br />
&nbsp;&nbsp;<strong><big>&middot;</big></strong> Votes: ' . $total_votes . '<br />
&nbsp;&nbsp;<strong><big>&middot;</big></strong> Avg. Score: ' . round($avg_score, 2) . '<br />
&nbsp;&nbsp;<strong><big>&middot;</big></strong> Total: ' . notate_size($total_filesize) . '<br />
<b>&#8226;</b>&nbsp;<a href="' . URL::index($dl_mod . '&amp;file=add') . '">Add Download</a><br />
<b>&#8226;</b>&nbsp;<a href="' . URL::index($dl_mod . '&amp;mode=new') . '">New Additions</a><br />
<b>&#8226;</b>&nbsp;<a href="' . URL::index($dl_mod . '&amp;mode=pop') . '">Popular Downloads</a><br />
<b>&#8226;</b>&nbsp;<a href="' . URL::index($dl_mod . '&amp;mode=top') . '">Top Downloads</a><br />
<b>&#8226;</b>&nbsp;<a href="' . URL::index($dl_mod . '&amp;mode=random') . '">Random Download</a>';
예제 #2
0
파일: index.php 프로젝트: cbsistem/nexos
        $pagetitle .= ' ' . _BC_DELIM . ' Select Mirror';
        $result = $db->sql_uquery('SELECT * FROM ' . $dl_prefix . "_mirrors \n\t\t\tWHERE did={$get_id} AND active=1 \n\t\t\tORDER BY url");
        $cpgtpl->assign_vars(array('DL_DETAIL_MENU' => dl_detail_menu($get_id, $dl_title, $dl_pick, $dl_active, 2), 'L_DL_FILE' => _DLP_DLNOW . ' ' . _BC_DELIM . ' Select Mirror', 'S_DL_DESC1' => sprintf('Please select a mirror below.', $dl_title), 'S_DL_DESC2' => 'Not all mirrors may have the latest version of the file available.', 'L_LOCATION' => 'Location', 'L_FILENAME' => _FILENAME, 'L_FILESIZE' => _FILESIZE, 'L_MD5_SUM' => 'MD5 Sum', 'L_VIEW_ESTIMATE' => 'View estimated download time', 'MD5_SET' => $dl_config['md5_local'] || $dl_config['md5_remote']));
        while ($mirror = $db->sql_fetchrow($result)) {
            $site = false;
            if (ereg('://', $mirror['url'])) {
                if (is_admin() || is_user() || $dl_config['anon_dl_remote']) {
                    $url = parse_url($mirror['url']);
                    $site = '<a href="' . $url['scheme'] . '://' . $url['host'] . '" target="_blank">' . $url['host'] . '</a>';
                }
            } elseif (is_admin() || is_user() || $dl_config['anon_dl']) {
                $site = $MAIN_CFG['server']['domain'];
            }
            if ($site) {
                $filename = basename($mirror['url']);
                $cpgtpl->assign_block_vars('mirror', array('FILENAME' => $filename, 'S_MD5' => $mirror['uploaded'] && !$dl_config['md5_local'] || !$mirror['uploaded'] && !$dl_config['md5_remote'] ? 'N/A' : $mirror['md5'], 'S_SITE' => $site, 'S_SIZE' => notate_size($mirror['filesize']), 'U_GET' => URL::index("&amp;get={$get_id}&amp;mirror=" . $mirror['id']), 'U_BROKEN' => URL::index('&amp;broken=' . $mirror['id']), 'U_POPUP' => URL::index('&amp;time=' . $mirror['id'], false, true)));
            }
        }
        require_once 'header.php';
        $cpgtpl->set_filenames(array('body' => 'downloads/mirrors.html'));
    }
    $cpgtpl->display('body');
} else {
    require_once 'header.php';
    // Editors pick
    $result = $db->sql_query("SELECT d.lid, d.cid, d.title, d.desc_short, d.screen, s.url as img_url FROM " . $dl_prefix . "_downloads d\n\t\tLEFT JOIN " . $dl_prefix . "_screenshots s ON (s.id = d.screen)\n\t\tWHERE d.pick=1 AND d.active=1 \n\t\tORDER BY RAND()");
    $count = $db->sql_numrows($result);
    $cpgtpl->assign_vars(array('B_EDITORSPICK' => $count));
    if ($count) {
        $picks = $db->sql_fetchrowset($result);
        $cpgtpl->assign_vars(array('L_READ_MORE' => 'Details', 'U_MOREPICKS' => URL::index('&amp;file=search&amp;key=pick'), 'L_MOREPICKS' => 'View more featured', 'L_VIEW_SHOT' => 'View Screenshot', 'L_FEATURED' => 'Featured download', 'TITLE' => $picks[0]['title'], 'SRC_IMG' => dl_thumbimage($picks[0]['img_url']), 'URL_IMG' => URL::index('&amp;screen=' . $picks[0]['screen']), 'DESC' => nl2br($picks[0]['desc_short']), 'DETAILS' => URL::index('&amp;file=details&amp;id=' . $picks[0]['lid'])));