示例#1
0
if (edit_allowed($user_id, $cat_edit_level) == TRUE) {
    $template->assign_block_vars('edit_allowed', array());
    if (time() >= $expiry_date - $ads_config['first_chase_days'] * 60 * 60 * 24) {
        $template->assign_block_vars('switch_renewal_allowed', array());
    }
    if ($status == 'active') {
        $template->assign_block_vars('switch_active', array());
    }
    if ($status == 'sold') {
        $template->assign_block_vars('switch_sold', array());
    }
}
if (delete_allowed($user_id, $cat_delete_level) == TRUE) {
    $template->assign_block_vars('delete_allowed', array());
}
if ($ads_config['images'] == 1 && image_allowed($user_id, $cat_image_level) == TRUE && $ad_type_code > 2) {
    $template->assign_block_vars('image_allowed', array());
}
if ($user_id != ANONYMOUS) {
    $template->assign_block_vars('non_guest_ad', array());
}
if ($edit_count > 0) {
    // Get recipients details from phpBB
    $profiledata = get_userdata($edit_user_id);
    $edit_details = sprintf($lang['last_edited_by'], $profiledata['username'], date($lang['DATE_FORMAT'], $edit_time), $edit_count);
}
$page_title = $title;
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
$template->set_filenames(array('item_page' => 'ads_item.tpl'));
// Do not allow details to be input for basic ads
if ($ad_type_code != 1) {
示例#2
0
         while ($row = $db->sql_fetchrow($result)) {
             $img_url = ADS_IMAGES_PATH . "ad" . $id . "_img" . $row["img_seq_no"] . "_medium.jpg";
             $delete_img_url = "ads_images.{$phpEx}?mode=delete&id={$id}&img_seq_no=" . $row['img_seq_no'];
             $template->assign_block_vars('imagecolumn', array('IMG_URL' => $img_url, 'U_DELETE_IMG_URL' => append_sid("{$delete_img_url}")));
         }
         $template->assign_block_vars('switch_images_found', array());
     }
     // Set the rest of the template variables
     $template->assign_vars(array('U_ADS_INDEX' => append_sid("adverts.{$phpEx}"), 'U_ADS_ITEM' => append_sid("ads_item.{$phpEx}?id={$id}"), 'U_CREATE_IMG' => append_sid("ads_images.{$phpEx}?id={$id}"), 'L_ADS_INDEX' => $lang['ads_index'], 'L_ADD_IMAGES' => $lang['add_images'], 'L_IMAGE_TYPES' => $lang['image_types'], 'L_UPLOAD_IMAGE' => $lang['upload_image'], 'L_DELETE_IMAGES' => $lang['delete_images'], 'SITE_NAME' => $board_config['sitename'], 'TITLE' => $title, 'ICON_DELETE' => $images['icon_delpost'], 'ID' => $id));
     $template->pparse('images_page');
 } else {
     // ================
     // Create the image
     // ================
     // Check permissions
     if (image_allowed($user_id, $cat_image_level) == FALSE) {
         if (!$userdata['session_logged_in']) {
             redirect(append_sid("login.{$phpEx}?redirect=ads_images.{$phpEx}&id={$id}"));
         } else {
             message_die(GENERAL_ERROR, $lang['Not_Authorised']);
         }
     }
     // Limit the number of ads for this user (also prevents flooding)
     $sql = "SELECT COUNT(*) AS count \n\t\t\t\t\tFROM " . ADS_IMAGES_TABLE . "\n\t\t\t\t\tWHERE id = '{$id}'\n\t\t\t\t\tAND img_deleted_ind = 0";
     $result = $db->sql_query($sql);
     $row = $db->sql_fetchrow($result);
     if ($row['count'] >= $ads_config['max_images_per_ad']) {
         message_die(GENERAL_ERROR, $lang['max_images_exceded']);
     }
     // Check that an actual images has been selected
     if (empty($_FILES['image']['size'])) {