Example #1
0
$m_size = getimagesize('themes/' . $CPG_SESS['theme'] . '/images/mainbar.gif');
$r_size = getimagesize('themes/' . $CPG_SESS['theme'] . '/images/rightbar.gif');
list($total_yearly_hits, $total_yearly_views) = $db->sql_ufetchrow("SELECT SUM(hits), SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}'", SQL_NUM);
list($total_monthly_hits, $total_monthly_views) = $db->sql_ufetchrow("SELECT SUM(hits), SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}'", SQL_NUM);
$yh = $db->sql_query("SELECT year, SUM(hits) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' \n\tGROUP BY year \n\tORDER BY year");
$mh = $db->sql_query("SELECT month, SUM(hits) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}' \n\tGROUP BY month \n\tORDER BY month", SQL_NUM);
$yv = $db->sql_query("SELECT year, SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' \n\tGROUP BY year \n\tORDER BY year");
$mv = $db->sql_query("SELECT month, SUM(views) FROM " . $dl_prefix . "_stats \n\tWHERE id='{$global_id}' AND year='{$time_year}' \n\tGROUP BY month \n\tORDER BY month", SQL_NUM);
$months = array(1 => _JANUARY, _FEBRUARY, _MARCH, _APRIL, _MAY, _JUNE, _JULY, _AUGUST, _SEPTEMBER, _OCTOBER, _NOVEMBER, _DECEMBER);
$colors = array(1 => '8D1B1B', '6740E1', '8D8D8D', 'CC8500', '5B781E');
$rand_colors = array_rand($colors);
//$modheader .= '<link rel="stylesheet" type="text/css" href="modules/'.$module_name.'/include/style.css" />';
$pagetitle .= $module_title . ' ' . _BC_DELIM . ' ' . _StatisticsLANG . ' ' . _BC_DELIM . ' ' . $dl_title;
require_once 'header.php';
OpenTable();
echo dl_detail_menu($global_id, $dl_title, $dl_pick, $dl_active, 5) . '<br /><br />
   <span class="genmed"><strong>' . _StatisticsLANG . '</strong></span><br />
   This download has received <strong>' . $tot_hits . '</strong> ' . strtolower(_HITS) . ' and <strong>' . $tot_views . '</strong> page views since it was published ' . generate_date($dl_date, 'F j, Y') . '.<br /><br />
   <span class="genmed"><strong>Yearly Hits</strong></span><br /><br />
    <table border="0" style="background:' . $bgcolor2 . ';" cellspacing="1" cellpadding="3">
     <tr>
       <td style="background:' . $bgcolor3 . ';">' . _YEAR . '</td>
       <td style="background:' . $bgcolor3 . ';" colspan="2">' . _HITS . '</td>
     </tr>';
while (list($h_year, $h_year_hits) = $db->sql_fetchrow($yh)) {
    $width = $h_year_hits == 0 ? 100 * $h_year_hits : round(100 * $h_year_hits / $total_yearly_hits, 0);
    echo '
     <tr style="background:' . $bgcolor1 . ';">
       <td>' . ($h_year != $time_year ? '<a href="' . URL::index('&amp;file=statistics&amp;id=' . $global_id . '&amp;h_year=' . $h_year) . '">' . $h_year . '</a>' : $h_year) . '</td>
       <td style="white-space:nowrap;"><img src="themes/' . $CPG_SESS['theme'] . '/images/leftbar.gif" alt="" width="' . $l_size[0] . '" height="' . $l_size[1] . '" /><img src="themes/' . $CPG_SESS['theme'] . '/images/mainbar.gif" alt="" width="' . $width * 2 . '" height="' . $m_size[1] . '" /><img src="themes/' . $CPG_SESS['theme'] . '/images/rightbar.gif" alt="" width="' . $r_size[0] . '" height="' . $r_size[1] . '" /></td>
       <td>' . $h_year_hits . '</td>
Example #2
0
$rating_info = get_rating($row['score'], $row['votes']);
if (!is_admin() && $row['submitter'] != is_user()) {
    update_views($global_id);
}
//$modheader .= '<link rel="stylesheet" type="text/css" href="modules/'.$module_name.'/include/style.css" />';
$pagetitle .= $module_title . ' ' . _BC_DELIM . ' ' . $row['title'];
if ($row['img_url']) {
    if (ereg('://', $row['img_url'])) {
        $row['img_url'] .= '" width="' . $dl_config['dimension_thumb'];
    } else {
        $row['img_url'] = dl_thumbimage($row['img_url']);
    }
}
$can_dl = can_download($row['active'], $row['access']);
//$submitter_count = $db->sql_count($dl_prefix.'_downloads', "submitter='".Fix_Quotes($row['submitter'])."'")-1;
$cpgtpl->assign_vars(array('L_SUBMITTEDBY' => _DLP_SUBMITTEDBY, 'L_AUTHORNAME' => _AUTHORNAME, 'L_AUTHOREMAIL' => _AUTHOREMAIL, 'L_PUBLISHED' => _DLP_PUBLISHED, 'L_UPDATED' => _DLP_UPDATED, 'L_DESCRIPTION' => _DESCRIPTION, 'L_CATEGORY' => _CATEGORY, 'L_RATING' => _RATING, 'L_VOTES' => _VOTES, 'L_DOWNLOADS' => _DOWNLOADS, 'L_ACTIVE' => _ACTIVE, 'L_EDIT' => _EDIT, 'L_DELETE' => _DELETE, 'L_ISDLOWNER' => sprintf(_DLP_ISDLOWNER, URL::index('&amp;file=manage&amp;edit=' . $global_id)), 'L_MIRSUB' => sprintf(_DLP_MIRSUB, URL::index('&amp;file=manage&amp;mirrors=' . $global_id)), 'L_EDNOTE' => _DLP_EDNOTE, 'L_MEMREVIEWS' => _DLP_MEMREVIEWS, 'L_PENDREVIEWS' => _DLP_PENDREVIEWS, 'L_BY' => _BY, 'L_ON' => _ON, 'L_PAGE' => _DLP_PAGE, 'L_VIEWALLSCREENS' => _DLP_VIEWALLSCREENS, 'L_POPULARITY' => _POPULARITY, 'L_PAGEVIEWS' => _DLP_PAGEVIEWS, 'L_ADMINTOOLS' => _ADMINISTRATION, 'L_EDPICK' => _DLP_EDPICK, 'DL_MENU' => dl_detail_menu($global_id, $row['title'], $row['pick'], $row['active'], 1), 'DL_CATEGORY' => DL_Cat::breadcrumb($row['cid']), 'DL_SUBMITTER' => is_numeric($row['submitter']) ? '<a href="' . URL::index('&amp;file=search&amp;sa=' . $row['submitter']) . '">' . $row['username'] . '</a>' : $row['submitter'], 'DL_AUTHORNAME' => $row['name'], 'DL_AUTHOREMAIL' => $row['email'] ? spam_protect($row['email']) : false, 'DL_PUBLISHED' => generate_date($row['date']), 'DL_PUBLISHTYPE' => mark_date($row['date'], 3, 1, 'right'), 'DL_UPDATED' => $row['updated'] > $row['date'] ? generate_date($row['updated']) : false, 'DL_UPDATE_TYPE' => $row['updated'] > $row['date'] ? mark_date($row['updated'], 3, 2, 'right') : false, 'DL_DESCRIPTION' => nl2br($row['desc_short']) . (!empty($row['desc_long']) ? decode_bbcode("\n\n" . $row['desc_long'], true) : ''), 'DL_NOTES' => decode_bbcode($row['notes']), 'DL_REVIEWS_ACTIVE' => $dl_config['r_active'], 'IMG_DL_RATING' => $rating_info['image'], 'DL_VOTES' => intval($row['votes']), 'DL_POPULARITY' => popularity($global_id), 'DL_HITS' => intval($row['hits']), 'DL_VIEWS' => intval($row['views']), 'DL_SUB_MIRRORS' => $dl_config['pub_mirror'], 'U_DL_SCREENSHOT' => URL::index('&amp;screen=' . $row['screen']), 'IMG_DL_SCREENSHOT' => $row['img_url'], 'B_DL_ADMIN' => can_admin($module_name), 'DL_IS_OWNER' => $row['submitter'] == $userinfo['user_id'], 'U_DL_DELETE' => URL::admin('&amp;del_dl=' . $global_id), 'U_DL_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $global_id), 'U_DL_MIRSUB' => URL::index('&amp;file=manage&amp;mirrors=' . $global_id), 'U_DL_MIRROR' => URL::index('&amp;mirror=' . $global_id), 'U_DL_MIRRORS' => URL::index('&amp;get=' . $global_id), 'U_DL_ACTIVE' => URL::admin('&amp;active=' . $global_id), 'U_DL_PICK' => URL::admin('&amp;pick=' . $global_id), 'IMG_DL_MIRRORS' => dl_image($can_dl ? 'download.png' : 'register.png'), 'IMG_DL_ACTIVE' => dl_image($row['active'] == 1 ? 'checked.png' : 'unchecked.png'), 'IMG_DL_PICK' => dl_image($row['pick'] ? 'checked.png' : 'unchecked.png'), 'S_DL_ACTIVE' => $row['active'] == 1 ? _YES : _NO, 'S_DL_PICK' => $row['pick'] ? _YES : _NO, 'S_DL_MIRRORS' => $can_dl ? _DLP_DLNOW : _DLP_NADL));
$result = $db->sql_query("SELECT field, title, type FROM " . $dl_prefix . "_fields \n\tWHERE type!=3 AND visible > 0");
if ($db->sql_numrows($result)) {
    while ($row2 = $db->sql_fetchrow($result)) {
        if ($row2['type'] == 1) {
            $row[$row2['field']] = $row[$row2['field']] ? _YES : _NO;
        }
        if ($row[$row2['field']]) {
            $row2['title'] = defined($row2['title']) ? constant($row2['title']) : $row2['title'];
            if ($row2['field'] == 'homepage' && $row[$row2['field']]) {
                $row[$row2['field']] = '<a href="' . $row[$row2['field']] . '" target="_blank">' . shrink_url($row[$row2['field']]) . '</a>';
            }
            $cpgtpl->assign_block_vars('dl_field', array('TITLE' => $row2['title'], 'VALUE' => $row[$row2['field']]));
        }
    }
}
Example #3
0
             require_once 'header.php';
             $cpgtpl->assign_vars(array('DL_DETAIL_MENU' => dl_detail_menu($get_id, $dl_title, $dl_pick, $dl_active, 2), 'L_DL_FILE' => _DLP_DLNOW, 'S_DL_NOW' => 'Your download will begin in five seconds...<br /><br />If the file has not started to download after five seconds, get it <a href="' . $dl_url . '">here</a>.'));
         } else {
             require_once 'includes/classes/cpg_file.php';
             if (!CPG_File::secure_download($error, $dl_url, $dl_filename)) {
                 $db->sql_query("INSERT INTO " . $dl_prefix . "_broken \n\t\t\t\t\t(id, lid, mid, uid, report, date, ip)\n\t\t\t\t\tVALUES \n\t\t\t\t\t(DEFAULT, '{$get_id}', '{$mirror_id}', '" . $userinfo['user_id'] . "', 'Automatically submitted: " . Fix_Quotes($error) . "', '" . time() . "', '" . $userinfo['user_ip'] . "')");
                 cpg_error('<strong>File is not available for download</strong><br /><br />A broken mirror report has been filed. You can try <a href="' . URL::index('&amp;get=' . $get_id) . '">selecting a different mirror</a>.<br /><br />We apologize for the inconvenience.', 'Broken Mirror');
             }
             exit;
         }
     }
     $cpgtpl->set_filenames(array('body' => 'downloads/fetchpage.html'));
 } else {
     $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)));
         }
     }