Esempio n. 1
0
 function echo_views($post_id)
 {
     if (update_views($post_id) == 1) {
         $views = get_views($post_id);
         echo number_format_i18n($views);
     } else {
         echo 0;
     }
 }
            case "sold_ad":
                $new_status = 1;
                break;
            case "close_ad":
                $new_status = 2;
                break;
        }
        $sql = 'UPDATE ' . CLASSIFIEDS_TABLE . '
              SET ad_status = ' . $new_status . '
    						WHERE ad_id = ' . $ad_id;
        $db->sql_query($sql);
        redirect(append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/single_ad.{$phpEx}", 'ad_id=' . $ad_id));
    }
}
// Update the views for the ad.
update_views($ad_id);
// Is the ad reported?
if ($row['reported']) {
    $sql = 'SELECT c.reported_by, c.report_text, u.username, u.user_colour, u.user_id
		FROM ' . CLASSIFIEDS_TABLE . ' c, ' . USERS_TABLE . ' u
		WHERE c.reported_by = u.user_id
			AND c.ad_id = ' . $ad_id;
    $result = $db->sql_query_limit($sql, 1);
    $report = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
    $template->assign_vars(array('REPORTER' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']), 'REPORT_TEXT' => $report['report_text']));
}
$allow_bbcode = $allow_urls = $allow_smilies = true;
$row['bbcode_options'] = ($allow_bbcode ? OPTION_FLAG_BBCODE : 0) + ($allow_smilies ? OPTION_FLAG_SMILIES : 0) + ($allow_urls ? OPTION_FLAG_LINKS : 0);
$description = generate_text_for_display($row['ad_description'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
// Load custom profile fields
Esempio n. 3
0
require_once 'modules/' . $module_name . '/functions/info.inc';
require_once 'modules/' . $module_name . '/functions/linking.inc';
if (!isset($_GET['id'])) {
    URL::redirect(URL::index());
}
$row = $db->sql_ufetchrow("SELECT d.*, SUM(s.hits) AS hits, SUM(s.views) AS views, i.url AS img_url, u.username FROM " . $dl_prefix . "_downloads d\n\tLEFT JOIN " . $dl_prefix . "_stats s ON (s.id = d.lid)\n\tLEFT JOIN " . $dl_prefix . "_screenshots i ON (i.id = d.screen)\n\tLEFT JOIN " . $user_prefix . "_users u ON (u.user_id = d.submitter)\n\tWHERE d.lid='{$global_id}' \n\tGROUP BY d.lid, d.cid, d.active, d.access, d.title, d.screen, d.desc_short, d.desc_long, d.notes, d.date, d.updated, d.name, d.email, d.submitter, d.filesize, d.version, d.homepage, d.compat, d.pick, i.url, u.username");
list($row['score'], $row['votes']) = $db->sql_ufetchrow("SELECT SUM(score), COUNT(score) FROM " . $dl_prefix . "_ratings \n\tWHERE lid='{$global_id}' AND active=1 \n\tGROUP BY lid");
if (!isset($row['title'])) {
    cpg_error(_DLP_UNKNOWNDL, 404);
}
if ($row['active'] != 1 && !can_admin($module_name)) {
    cpg_error(_DLP_INACTIVEDL);
}
$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)) {