comparison image/ad_image.module @ 7:6aeff3329e01 ad

maj module ad 2.1rc1
author piotre
date Mon, 20 Jul 2009 13:54:40 +0000
parents e5584a19768b
children
comparison
equal deleted inserted replaced
6:b7653861e0b4 7:6aeff3329e01
1 <?php 1 <?php
2 // $Id: ad_image.module,v 1.2.2.13.2.40.2.11.2.6 2009/04/02 15:48:29 jeremy Exp $ 2 // $Id: ad_image.module,v 1.2.2.13.2.40.2.11.2.7 2009/05/15 13:27:23 jeremy Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Enhances the ad module to support banner ads. 6 * Enhances the ad module to support banner ads.
7 * 7 *
279 } 279 }
280 else { 280 else {
281 db_query("UPDATE {ad_image} SET fid = %d, url = '%s', tooltip = '%s', remote_image = '%s', width = %d, height = %d WHERE aid = %d", $fid, $node->url, $node->tooltip, $node->remote_image, isset($node->width) ? $node->width : 0, isset($node->height) ? $node->height : 0, $node->nid); 281 db_query("UPDATE {ad_image} SET fid = %d, url = '%s', tooltip = '%s', remote_image = '%s', width = %d, height = %d WHERE aid = %d", $fid, $node->url, $node->tooltip, $node->remote_image, isset($node->width) ? $node->width : 0, isset($node->height) ? $node->height : 0, $node->nid);
282 } 282 }
283 // No valid image has been uploaded, don't allow ad to be 'active'. 283 // No valid image has been uploaded, don't allow ad to be 'active'.
284 if ($image === FALSE || !ad_image_active_file(($node->files))) { 284 if (($node->remote_image && $image === FALSE) ||
285 (!$node->remote_image &&
286 ($image === FALSE || !ad_image_active_file(($node->files)))
287 )) {
285 db_query("UPDATE {ads} SET adstatus = '%s' WHERE aid = %d AND adstatus = '%s'", t('pending'), $node->nid, t('active')); 288 db_query("UPDATE {ads} SET adstatus = '%s' WHERE aid = %d AND adstatus = '%s'", t('pending'), $node->nid, t('active'));
286 if (db_affected_rows()) { 289 if (db_affected_rows()) {
287 drupal_set_message(t('Image validation failed, unable to mark ad as %active. Setting ad as %pending.', array('%active' => t('active'), '%pending' => t('pending'))), 'error'); 290 drupal_set_message(t('Image validation failed, unable to mark ad as %active. Setting ad as %pending.', array('%active' => t('active'), '%pending' => t('pending'))), 'error');
288 } 291 }
289 } 292 }