Mercurial > defr > drupal > ad
diff text/ad_text.module @ 1:948362c2a207 ad
update advertisement
author | pierre |
---|---|
date | Thu, 02 Apr 2009 15:28:21 +0000 |
parents | d8a3998dac8e |
children |
line wrap: on
line diff
--- a/text/ad_text.module Fri Feb 20 14:04:09 2009 +0000 +++ b/text/ad_text.module Thu Apr 02 15:28:21 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad_text.module,v 1.2.2.7.2.24.2.13 2009/02/17 18:56:26 jeremy Exp $ +// $Id: ad_text.module,v 1.2.2.7.2.24.2.13.2.3 2009/03/31 04:41:03 jeremy Exp $ /** * @file @@ -26,6 +26,9 @@ */ function theme_ad_text_ad($ad) { if (isset($ad->aid)) { + if (!isset($ad->adheader)) { + $ad = node_load($ad->aid); + } $output = '<div class="text-advertisement" id="ad-'. $ad->aid .'">'; if (isset($ad->url) && !empty($ad->url)) { $output .= theme('ad_text_text', ad_text_display_prepare($ad->adheader, $ad->format), ad_text_display_prepare($ad->adbody, $ad->format), $ad->redirect .'/@HOSTID___'); @@ -199,7 +202,7 @@ break; case 'update': - if (ad_adaccess($node, 'manage ad text')) { + if (ad_permission($node->nid, 'manage ad text')) { db_query("UPDATE {ad_text} SET url = '%s', adheader = '%s', adbody = '%s' WHERE aid = %d", $node->url, $node->adheader, $node->adbody, $node->nid); } break; @@ -233,7 +236,7 @@ case 'permissions': if (!isset($node->adtype) || $node->adtype == 'text') { - return array('manage ad text'); + return array('manage ad text' => TRUE); } } } @@ -250,7 +253,7 @@ '#collapsible' => TRUE, ); - if (ad_adaccess($node, 'manage ad text') || arg(1) == 'add' && user_access('create advertisements')) { + if (arg(1) == 'add' && user_access('create advertisements') || ad_permission($node->nid, 'manage ad text')) { $access = TRUE; } else {