Example #1
0
            $i = 0;
            while (list($review_id, $review_uid, $review_ip, $review_title, $review_comment, $review_score, $review_timestamp, $review_uname, $review_votes) = $db->sql_fetchrow($result)) {
                $rating_info = get_rating($review_score, $review_votes);
                $cpgtpl->assign_block_vars('dl_p_review', array('ID' => $review_id, 'U_ID' => htmlprepare(URL::uri()) . '#r' . $review_id, 'RATING' => _DLP_REVIEW . ' #' . $review_id . ': ' . $rating_info['desc'], 'U_MEMBER' => URL::index('Your_Account&amp;profile=' . $review_uid), 'MEMBERNAME' => $review_uname, 'DATE' => generate_date($review_timestamp), 'U_DEL' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;del_review=' . $review_id) . '">[' . strtolower(_DELETE) . ']</a>' : false, 'U_APPR' => can_admin($module_name) || $row['submitter'] == $userinfo['user_id'] ? '<a href="' . URL::index('&amp;approve_review=' . $review_id) . '">[' . strtolower(_DLP_APPROVE) . ']</a>' : false, 'TITLE' => $review_title, 'COMMENT' => decode_bb_all($review_comment), 'IP' => decode_ip($review_ip), 'IMG_RATE' => dl_image('stars/' . $rating_info['rating'] . '.png'), 'SPACER' => $i > 0));
                $i++;
            }
        } else {
            $cpgtpl->assign_var('DL_P_REVIEWS', false);
        }
        $db->sql_freeresult($result);
    } else {
        $cpgtpl->assign_var('DL_P_REVIEWS', false);
    }
}
if ($row['pick']) {
    $cpgtpl->assign_block_vars('dl_image', array('SRC' => dl_image('pick.png'), 'TITLE' => _DLP_EDPICK));
}
// custom fields: images
$result = $db->sql_query("SELECT field, img_path, img_alt FROM " . $dl_prefix . "_fields \n\tWHERE type=3 AND visible > 0");
if ($db->sql_numrows($result)) {
    while ($row2 = $db->sql_fetchrow($result)) {
        if ($row[$row2['field']]) {
            $cpgtpl->assign_block_vars('dl_image', array('SRC' => $row2['img_path'], 'TITLE' => $row2['img_alt']));
        }
    }
}
$db->sql_freeresult($result);
require_once 'header.php';
$cpgtpl->assign_var('BGCOLOR3', $bgcolor3);
$cpgtpl->set_filenames(array('body' => 'downloads/details.html'));
$cpgtpl->display('body');
Example #2
0
 function add_result($row)
 {
     global $db, $dl_prefix, $cpgtpl, $module_name;
     $this->result[$this->result_count++] = $row;
     $rating_info = get_rating($row['score'], $row['votes']);
     if ($row['date'] >= $row['updated']) {
         $row['date'] = _DLP_PUBLISHED . ': ' . generate_date($row['date']) . mark_date($row['date'], 3, 1, '', 2);
     } else {
         $row['date'] = _DLP_UPDATED . ': ' . generate_date($row['updated']) . mark_date($row['updated'], 3, 2, '', 2);
     }
     if (can_download($row['active'], $row['access'])) {
         $img = dl_image($row['access'] > 0 ? 'download_small_yes.png' : 'download_small.png');
         $img_title = _DLP_DLNOW;
     } else {
         $img = dl_image('download_small_no.png');
         $img_title = _DLP_DLFORBIDDEN;
     }
     if ($row['img_url']) {
         if (ereg('://', $row['img_url'])) {
             $row['img_url'] .= '" width="100';
         } else {
             $row['img_url'] = dl_thumbimage($row['img_url']) . '" width="100';
         }
     }
     $cpgtpl->assign_block_vars('dl_item', array('TITLE' => $row['title'], 'U_INFO' => URL::index('&amp;file=details&amp;id=' . $row['lid']), 'U_GET' => URL::index('&amp;get=' . $row['lid']), 'U_IMG' => $row['screen'] ? URL::index('&amp;screen=' . $row['screen']) : '', 'U_HOME' => $row['homepage'], 'U_WRITE' => URL::index('&amp;review=' . $row['lid']), 'U_REVIEWS' => URL::index('&amp;file=details&amp;id=' . $row['lid'] . '#reviews'), 'NO_REVIEWS' => $row['votes'] == 0 && is_user(), 'REVIEWS' => sprintf($row['votes'] == 1 ? '%s review' : '%s reviews', $row['votes']), 'VERSION' => !empty($row['version']) ? _VERSION . ' ' . $row['version'] : '', 'NOT_ACTIVE' => $row['active'] == 0 && can_admin($module_name) ? _DLP_INACTIVE : '', 'E_PICK' => $row['pick'] ? _DLP_EDPICK : '', 'SECURE' => isset($row['cpgcs']) && $row['cpgcs'] ? 'Certified Secure' : '', 'SUBMITTER' => is_numeric($row['submitter']) ? '<a href="' . URL::index('&amp;file=search&amp;sa=' . $row['submitter']) . '">' . $row['username'] . '</a>' : $row['submitter'], 'DL_IMG' => $img, 'DL_IMG_TITLE' => $img_title, 'RATING_IMG' => $rating_info['image'], 'POP_IMG' => popularity($row['lid']), 'DATE' => $row['date'], 'DESC' => nl2br($row['desc_short']), 'U_SCREEN' => URL::index('&amp;screen=' . $row['screen']), 'IMG_SCREEN' => $row['img_url'], 'IMG_MISSING' => dl_image('missing.png'), 'L_VIEWALLSCREENS' => _DLP_VIEWALLSCREENS, 'L_NOSCREENS' => _DLP_NOSCREENSHOTS, 'L_SUBMITTEDBY' => _DLP_SUBMITTEDBY));
 }
Example #3
0
                    $url = parse_url($row['mirror_url']);
                    $site = shrink_url($url['host']);
                } else {
                    $site = $MAIN_CFG['server']['domain'];
                }
                $cpgtpl->assign_block_vars('dl_item', array('BGCOLOR' => $bgcolor, 'DATE' => generate_date($row['date']), 'TITLE' => $row['title'], 'URL' => URL::index('&amp;file=details&amp;id=' . $row['id']), 'MIRROR' => $row['mirror_url'], 'MIRROR_SITE' => $site, 'REPORT' => $row['report'], 'U_USER' => URL::index('Your_Account&amp;profile=' . $row['uid']), 'USERNAME' => $row['username'], 'U_DISMISS' => URL::index('&amp;file=manage&amp;s=2&amp;dismiss=' . $row['id']), 'U_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $row['lid'])));
            }
        }
        $db->sql_freeresult($result);
        $cpgtpl->set_filenames(array('body' => 'downloads/my_broken.html'));
    } else {
        $pagetitle .= ' ' . _BC_DELIM . ' Current';
        $total_author = $db->sql_count($dl_prefix . '_downloads', "submitter='{$userinfo['user_id']}' AND active!=2");
        $cpgtpl->assign_vars(array('L_CATEGORY' => _CATEGORY, 'L_EDIT' => _EDIT, 'DL_MENU' => '<span class="gen"><strong>My Downloads</strong></span><br /><a href="' . URL::index() . '">Main Page</a> | <strong>Current Downloads</strong> | <a href="' . URL::index('&amp;file=manage&amp;s=1') . '">Pending Downloads</a> | <a href="' . URL::index('&amp;file=manage&amp;s=2') . '">Broken D/L Reports</a>', 'DL_NO_ITEMS' => $total_author < 1 ? sprintf(_ERROR_NONE_TO_DISPLAY, strtolower(_DOWNLOADS)) : false, 'DL_PAGINATION' => ceil($total_author / $perpage) > 1 ? gen_pagination($total_author, $perpage, $cur_page, '&amp;file=manage') : false));
        if ($total_author) {
            $rating = $db->sql_query("SELECT lid, SUM(score)/COUNT(lid) AS score FROM " . $dl_prefix . "_ratings \n\t\t\tGROUP BY lid");
            while ($rows = $db->sql_fetchrow($rating)) {
                $ratings[$rows[0]]['score'] = $rows[1];
            }
            $result = $db->sql_query("SELECT d.lid, d.cid, d.title, d.active, d.desc_short, SUM(s.hits) as hits, SUM(s.views) as views FROM " . $dl_prefix . "_downloads d\n\t\t\t\tLEFT JOIN " . $dl_prefix . "_stats s ON (s.id = d.lid)\n\t\t\t\tWHERE d.submitter='{$userinfo['user_id']}' AND d.active!=2 \n\t\t\t\tGROUP BY d.lid, d.cid, d.title, d.active, d.desc_short \n\t\t\t\tLIMIT {$perpage} OFFSET {$limit}");
            while ($row = $db->sql_fetchrow($result)) {
                $rating_info = isset($ratings[$row['lid']]['score']) ? get_rating($ratings[$row['lid']]['score'], 1) : get_rating(0, 0);
                $cpgtpl->assign_block_vars('dl_item', array('TITLE' => $row['title'], 'U_DETAILS' => URL::index('&amp;file=details&amp;id=' . $row['lid']), 'U_EDIT' => URL::index('&amp;file=manage&amp;edit=' . $row['lid']), 'CATEGORY' => DL_Cat::breadcrumb($row['cid']), 'ACTIVE' => $row['active'] == 1 ? _ACTIVE : _INACTIVE, 'IMG_ACTIVE' => dl_image($row['active'] == 1 ? 'checked.png' : 'unchecked.png'), 'IMG_RATE' => $rating_info['image'], 'IMG_POP' => popularity($row['lid']), 'VIEWS' => $row['views'], 'HITS' => $row['hits']));
            }
            $db->sql_freeresult($result);
        }
        $cpgtpl->set_filenames(array('body' => 'downloads/my_downloads.html'));
    }
    require_once 'header.php';
    $cpgtpl->display('body');
}