Example #1
0
" />

		</form>

		<div class="clear"></div>

	</div>

<?php 
} else {
    ?>

		<h2 class="dotted"><?php 
    _e('An Error Has Occurred', APP_TD);
    ?>
</h2>

		<div class="thankyou">
			<p><?php 
    echo appthemes_error_msg($error_msg);
    ?>
</p>
			<input type="button" name="goback" class="btn_orange" value="&lsaquo;&lsaquo; <?php 
    _e('Go Back', APP_TD);
    ?>
" onclick="history.back()" />
		</div>


<?php 
}
            $imagecount = cp_count_ad_images($_POST['ad_id']);
            //1
            $maximages = get_option('cp_num_images');
            //2
            // only allow the max number of images to each ad. prevents page reloads adding more
            if ($maximages > $imagecount) {
                // create the array that will hold all the post values
                $postvals = array();
                // now upload the new image
                $postvals = cp_process_new_image($_POST['ad_id']);
                // associate the already uploaded images to the ad and create multiple image sizes
                $attach_id = cp_associate_images($_POST['ad_id'], $postvals['attachment']);
            }
        } else {
            // images didn't upload
            $the_msg = appthemes_error_msg($error_msg);
        }
    }
    // update the ad content
    $the_msg .= cp_update_listing();
}
// MAIN PAGE STARTS HERE -->
// get the ad id from the querystring.
$aid = appthemes_numbers_only($_GET['aid']);
// make sure the ad id is legit otherwise set it to zero which will return no results
if (!empty($aid)) {
    $aid = $aid;
} else {
    $aid = '0';
}
// select post information and also category with joins.