Exemplo n.º 1
0
function includeAuctionSpecialBlock()
{
    global $template, $lang, $db, $board_config, $userdata, $phpEx, $images;
    $auction_config_data = init_auction_config();
    // Just display if switched on via ACP
    if ($auction_config_data['auction_block_display_specials'] == 1) {
        $sql = "SELECT PK_auction_offer_id,\r\n                                    auction_offer_title,\r\n                                    auction_offer_picture,\r\n                                    auction_offer_time_stop\r\n                             FROM " . AUCTION_OFFER_TABLE . "\r\n                             WHERE auction_offer_state=0 AND\r\n                                   auction_offer_special=1 AND\r\n                                   auction_offer_paid=1 AND\r\n                                   auction_offer_time_start < " . time() . " AND\r\n                                   auction_offer_time_stop > " . time() . "\r\n                             ORDER BY auction_offer_time_stop DESC\r\n                             LIMIT 0, " . $auction_config_data['auction_block_specials_limit'] . "";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query news', '', __LINE__, __FILE__, $sql);
        }
        // End if
        $specials_count = 0;
        $specials_row = array();
        while ($row = $db->sql_fetchrow($result)) {
            $specials_row[] = $row;
            $specials_count++;
        }
        // End while
        $template->assign_block_vars('special_block', array('L_AUCTION_SPECIAL_OFFERS_TITLE' => $lang['auction_special_offers']));
        for ($i = 0; $i < $specials_count; $i++) {
            $auction_offer_id = $specials_row[$i]['PK_auction_offer_id'];
            // BEGIN include auction-pic-config information
            $auction_config_pic = init_auction_config_pic();
            // END include auction-pic-config information
            // get info for admin and mod. Admin and mod see the offer-pic even if it has not been validated yet
            // this is only valid if validation is active
            if ($auction_config_pic['auction_offer_pic_approval_admin'] == 1) {
                if ($userdata['user_level'] == ADMIN or $userdata['user_level'] == MOD) {
                    $x_sql = "";
                } else {
                    $x_sql = "AND pic_approval = 0 AND pic_lock = 0 ";
                }
            } else {
                if ($userdata['user_level'] == ADMIN or $userdata['user_level'] == MOD) {
                    $x_sql = "";
                } else {
                    $x_sql = "AND pic_lock = 0 ";
                }
            }
            // specials pictures
            $sql = "SELECT pic_id, crop_id\r\n\t\t\t\tFROM " . AUCTION_IMAGE_TABLE . "\r\n\t\t\t\tWHERE pic_auction_id = '{$auction_offer_id}' AND\r\n                                      pic_main = 1 {$x_sql}";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not get pic  special-offer information  for auction id: ' . $auction_offer_id, '', __LINE__, __FILE__, $sql);
            }
            $pic_row = $db->sql_fetchrow($result);
            $mini_pic_id = $pic_row['pic_id'];
            $mini_crop_id = $pic_row['crop_id'];
            if ($mini_pic_id > 0) {
                $pic_yes = 1;
                $image_url = append_sid('auction_thumbnail.' . $phpEx . '?pic_type=3&crop=' . $mini_crop_id . '&pic_id=' . $mini_pic_id);
                $pic_width = $auction_config_pic['auction_offer_mini_size'];
                $pic_height = $auction_config_pic['auction_offer_mini_size'];
            } else {
                $pic_yes = 0;
            }
            // special pictures end
            $template->assign_block_vars('special_block.special_offer_block', array('AUCTION_SPECIAL_TITLE' => subStr($specials_row[$i]['auction_offer_title'], 0, 20), 'U_AUCTION_SPECIAL_TITLE' => append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']), 'AUCTION_SPECIAL_END' => datediff(time(), $specials_row[$i]['auction_offer_time_stop']), 'AUCTION_SPECIAL_IMAGE' => $pic_yes == 0 ? '<a href="' . append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']) . '"><img src="' . $images['icon_auction_no_pic'] . '" alt="' . $lang['auction_user_rating_view_offer'] . '" title="' . $lang['auction_user_rating_view_offer'] . '" border="0" /></a>' : '<a href="' . append_sid("auction_offer_view.php?" . POST_AUCTION_OFFER_URL . "=" . $specials_row[$i]['PK_auction_offer_id']) . '"><img src="' . $image_url . '" width="' . $pic_width . '" height="' . $pic_height . '" alt="' . $lang['auction_user_rating_view_offer'] . '" title="' . $lang['auction_user_rating_view_offer'] . '" border="0" /></a>'));
        }
        // End for
    }
    // End if
}
Exemplo n.º 2
0
         // we fetch the image parameters
         $auction_config_pic = init_auction_config_pic();
         // we include the upload file
         // all the upload work is done there
         include $phpbb_root_path . 'auction/graphic_files/auction_pic_upload.' . $phpEx;
     }
 } elseif ($HTTP_POST_VARS['auction_offer_url_file'] != "" and $HTTP_POST_VARS['auction_offer_url_file'] != "http://") {
     $upload_mode = 2;
     $avatar_filename = $HTTP_POST_VARS['auction_offer_url_file'];
     $error = false;
     // If the include does not exist we exit
     if (!file_exists($phpbb_root_path . 'auction/graphic_files/auction_pic_upload.' . $phpEx)) {
         message_die(GENERAL_ERROR, $lang['auction_pic_upload_missing']);
     } else {
         // we fetch the image parameters
         $auction_config_pic = init_auction_config_pic();
         // we include the upload file. all the upload work is done there
         include $phpbb_root_path . 'auction/graphic_files/auction_pic_upload.' . $phpEx;
     }
 }
 /* TODO: Check pic approval not 100% sure if it works like i want:
 			If uploader is admin he doesn't need approval.
 			If uploader is mod and mod can approve pictures he doesn't need approval
 			If uploader is mod and mods cannot approve pictures he needs approval by admin
 			Normal users also need approval
 			if approval is off then nobody needs approval
 			*/
 if ($auction_config_pic['auction_offer_pic_approval_admin'] == 1) {
     if ($userdata['user_level'] == ADMIN) {
         $pic_approval = 0;
     } else {
Exemplo n.º 3
0
// end include language file
if (isset($HTTP_GET_VARS['ao'])) {
    $offer_id = intval($HTTP_GET_VARS['ao']);
    $offer_id = htmlspecialchars($offer_id);
} elseif (isset($HTTP_POST_VARS['ao'])) {
    $offer_id = intval($HTTP_POST_VARS['ao']);
    $offer_id = htmlspecialchars($offer_id);
} else {
    message_die(GENERAL_ERROR, $lang['auction_offer_does_not_exist']);
}
$user_id = $userdata['user_id'];
if ($user_id < 1 or !$userdata['session_logged_in']) {
    redirect(append_sid("login.{$phpEx}?redirect=auction_pics_manager.{$phpEx}?ao={$offer_id}"));
}
// get configuration
$auction_pic_config = init_auction_config_pic();
// we set the height of the popup if url upload is enabled or not
if ($auction_pic_config['allow_url_upload'] == 1) {
    $up_pop_height = 350;
} else {
    $up_pop_height = 250;
}
// check auto_gd AND if gd is present. No gallery without GD
if ($auction_pic_config['gd_version'] > 0) {
    $my_gd = function_exists('imagecopyresampled') ? 2 : (function_exists('imagecopyresized') ? 1 : 0);
    /*********************************************************
    	if gd is not enabled ( of falsely enabled !!!) we do not allow the user to use the gallery!!! the images will be to big for the page to load. So remove the following lines at your own risk. No support if you do it
    	**********************************************************/
    if ($auction_pic_config['allow_thumb_gallery'] == 1 and $my_gd == 0) {
        $auction_pic_config['allow_thumb_gallery'] = 0;
    }