Mercurial > defr > drupal > ad
changeset 8:32c1a7d9e1fa ad tip
maj module ad en 2.1
author | sly |
---|---|
date | Fri, 11 Sep 2009 11:10:20 +0000 |
parents | 6aeff3329e01 |
children | |
files | ad.info ad.module ad_flash-5.x-1.x-dev.tar.gz cache/file/ad_cache_file.info channel/ad_channel.info channel/ad_channel.install channel/ad_channel.module documentation/CHANGELOG.txt documentation/README.txt embed/ad_embed.info external/ad_external.info html/ad_html.info image/ad_image.info notify/ad_notify.info owners/ad_owners.info remote/ad_remote.info remote/ad_remote.module report/ad_report.info statistics/click_filter/click_filter.info statistics/click_filter/click_filter.module text/ad_text.info weight/probability/ad_weight_probability.info |
diffstat | 22 files changed, 265 insertions(+), 125 deletions(-) [+] |
line wrap: on
line diff
--- a/ad.info Mon Jul 20 13:54:40 2009 +0000 +++ b/ad.info Fri Sep 11 11:10:20 2009 +0000 @@ -4,9 +4,9 @@ dependencies[] = taxonomy description = An advertising system for Drupal powered websites. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/ad.module Mon Jul 20 13:54:40 2009 +0000 +++ b/ad.module Fri Sep 11 11:10:20 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad.module,v 1.2.2.29.2.83.2.16.2.23 2009/07/06 21:47:49 jeremy Exp $ +// $Id: ad.module,v 1.2.2.29.2.83.2.16.2.26 2009/08/05 00:13:36 jeremy Exp $ /** * @file @@ -185,12 +185,7 @@ } if (user_access('show advertisements')) { - if (isset($options['div']) && $options['div'] !== FALSE) { - return theme('ad_display', $group, $output, $options['ad_display']); - } - else { - return theme('ad_display', $group, $output, 'raw'); - } + return theme('ad_display', $group, $output, $options['ad_display']); } else { return theme('ad_display', 'none', "<!-- Enable 'show advertisements' permission if you wish to display ads here. -->"); @@ -599,27 +594,30 @@ '#required' => TRUE, '#default_value' => isset($node->title) ? $node->title : '', ); - $form['body_filter']['body'] = array( - '#type' => 'textarea', - '#title' => t('Description'), - '#default_value' => isset($node->body) ? $node->body : '', - '#rows' => 3 - ); + if ($type->has_body) { + $form['body_filter']['body'] = array( + '#type' => 'textarea', + '#title' => t('Description'), + '#default_value' => isset($node->body) ? $node->body : '', + '#rows' => 3 + ); + } $form['body_filter']['format'] = filter_form($node->format); // determine the current ad type if (!isset($adtype)) { $adtypes = ad_get_types(); - if (sizeof($adtypes) == 1) { + if (count($adtypes) == 1) { $adtype = key($adtypes); } - else if (!sizeof($adtypes)) { + else if (!count($adtypes)) { drupal_set_message(t('At least one ad type module must be enabled before you can create advertisements. For example, try <a href="!url">enabling</a> the ad_text or ad_image module.', array('!url' => url('admin/build/modules'))), 'error'); } } // display ad type switch - if (!isset($node->adtype) || isset($node->adtype_select)) { + if ((!isset($node->adtype) || isset($node->adtype_select)) && + count($adtypes) >1) { $adtypes = array(0 => '---'); $adtypes += ad_get_types('name'); $form['select'] = array( @@ -646,10 +644,13 @@ ); } // display type-specific options - if (isset($node->adtype) && $node->adtype) { + if ((isset($node->adtype) && $node->adtype) || count($adtypes) == 1) { if (isset($node->adtype_select) && $node->adtype_select && ($node->adtype_select != $node->adtype)) { $node->adtype = $node->adtype_select; } + if (count($adtypes) == 1) { + $node->adtype = $adtype; + } ad_form_add_adtype_elements($form, $node->adtype, $node); // add ahah wrapper $form['adtype_elements']['#prefix'] = '<div id="adtype-ahah-wrapper">';
--- a/cache/file/ad_cache_file.info Mon Jul 20 13:54:40 2009 +0000 +++ b/cache/file/ad_cache_file.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Provides a file-caching mechanism to improve ad serving performance. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/channel/ad_channel.info Mon Jul 20 13:54:40 2009 +0000 +++ b/channel/ad_channel.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Provides the ability to create advertisement channels, about which rules can be defined. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/channel/ad_channel.install Mon Jul 20 13:54:40 2009 +0000 +++ b/channel/ad_channel.install Fri Sep 11 11:10:20 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad_channel.install,v 1.1.4.8 2009/07/11 16:39:21 jeremy Exp $ +// $Id: ad_channel.install,v 1.1.4.9 2009/07/28 17:39:35 jeremy Exp $ /** * @@ -10,67 +10,180 @@ /** * Create the ad_channel schema. */ +function ad_channel_schema() { + $schema['ad_channel'] = array( + 'description' => 'The ad_channel table allows advertisements to be organized into channels against which rules can be applied.', + 'fields' => array( + 'chid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'description' => 'Unique channel ID.', + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The name of the channel.', + ), + 'description' => array( + 'type' => 'text', + 'size' => 'big', + 'not null' => FALSE, + 'description' => 'A description of the channel.', + ), + 'conid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + 'description' => 'ID of the container the channel is in.', + ), + 'weight' => array( + 'type' => 'int', + 'size' => 'medium', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + 'description' => 'Used when displaying channels to admins, heavier weights sink to the bottom.', + ), + 'display' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'no_channel_percent' => array( + 'type' => 'int', + 'size' => 'medium', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'inventory' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'urls' => array( + 'type' => 'text', + ), + 'groups' => array( + 'type' => 'text', + ), + ), + 'primary key' => array('chid'), + 'indexes' => array( + 'name' => array('name'), + ), + ); + $schema['ad_channel_remnant'] = array( + 'fields' => array( + 'aid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'remnant' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('aid', 'remnant'), + ); + $schema['ad_channel_container'] = array( + 'description' => 'The ad_channel_container table stores channel container definitions.', + 'fields' => array( + 'conid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'description' => 'Unique container ID.', + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The name of the container.', + ), + 'description' => array( + 'type' => 'text', + 'size' => 'big', + 'not null' => FALSE, + 'description' => 'A description of the container.', + ), + 'weight' => array( + 'type' => 'int', + 'size' => 'medium', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + 'description' => 'Used when displaying channels to admins, heavier weights sink to the bottom.', + ), + ), + 'primary key' => array('conid'), + ); + $schema['ad_channel_node'] = array( + 'description' => 'The ad_channel_node table stores per node channel information.', + 'fields' => array( + 'chid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'nid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('chid', 'nid'), + 'indexes' => array( + 'nid_chid' => array('nid', 'chid'), + ), + ); + $schema['ad_priority'] = array( + 'fields' => array( + 'aid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + 'priority' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'unsigned' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('aid', 'priority'), + ); + return $schema; +} + function ad_channel_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - default: - // TODO: PostgreSQL support. Patches welcome. - /* The ad_channel table stores channel definitions and rules. - */ - db_query("CREATE TABLE {ad_channel} ( - chid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - name VARCHAR(64) NOT NULL DEFAULT '', - description LONGTEXT NULL, - conid INT(11) UNSIGNED NOT NULL DEFAULT '0', - weight TINYINT(4) SIGNED NOT NULL DEFAULT '0', - display TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', - no_channel_percent INT(3) NOT NULL DEFAULT '0', - urls TEXT NULL, - groups TEXT NULL, - PRIMARY KEY (chid), - KEY (name) - );"); - /* The ad_channel_container table stores channel container definitions. - */ - db_query("CREATE TABLE {ad_channel_container} ( - conid INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - name VARCHAR(64) NOT NULL DEFAULT '', - description LONGTEXT NULL, - weight TINYINT(4) SIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (conid) - );"); - /* The ad_channel_node table stores per node channel information. - */ - db_query("CREATE TABLE {ad_channel_node} ( - chid INT(11) UNSIGNED NOT NULL DEFAULT '0', - nid INT(11) UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (chid, nid), - KEY (nid, chid) - );"); - /* The ad_channel_node table stores per node channel information. - */ - db_query("CREATE TABLE {ad_priority} ( - aid INT(11) UNSIGNED NOT NULL DEFAULT '0', - priority TINYINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (aid, priority) - );"); - } + // Create tables + drupal_install_schema('ad_channel'); } /** * Completely uninstall the ad channel module. */ function ad_channel_uninstall() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - default: - // TODO: PostgreSQL support. Patches welcome. - db_query('DROP TABLE {ad_channel}'); - db_query('DROP TABLE {ad_channel_container}'); - db_query('DROP TABLE {ad_channel_node}'); - } + // Drop tables + drupal_uninstall_schema('ad_channel'); } /**
--- a/channel/ad_channel.module Mon Jul 20 13:54:40 2009 +0000 +++ b/channel/ad_channel.module Fri Sep 11 11:10:20 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad_channel.module,v 1.1.4.26 2009/07/17 21:29:37 jeremy Exp $ +// $Id: ad_channel.module,v 1.1.4.27 2009/07/29 23:00:39 jeremy Exp $ /** * @file @@ -1094,7 +1094,7 @@ $form['URL_rules']['urls'] = array( '#type' => 'textarea', '#title' => t('Paths'), - '#description' => t("Enter one URL per line. If serving ads locally use Drupal relative paths. If serving ads remotely include the 'http://' or 'https:/'. Use '<front>' to specify the front page. The '*' character is a wildcard. Example URLs are <em>blog</em> for the blog page and <em>blog/*</em> for every personal blog on your local website."), + '#description' => t("Enter one URL per line. If serving ads locally use Drupal relative paths. If serving ads remotely include the 'http://' or 'https:/'. Use '<front>' to specify the front page. The '*' character is a wildcard. Example URLs are <em>blog</em> for the blog page and <em>blog/*</em> for every personal blog on your local website. When specifying local paths you must enter the raw path (ie 'node/123') and not the url alias (ie 'my/custom/path'), if any."), '#default_value' => $chid ? unserialize($channel->urls) : '', );
--- a/documentation/CHANGELOG.txt Mon Jul 20 13:54:40 2009 +0000 +++ b/documentation/CHANGELOG.txt Fri Sep 11 11:10:20 2009 +0000 @@ -1,4 +1,26 @@ -$Id: CHANGELOG.txt,v 1.2.2.40.2.176.2.41.2.94 2009/07/17 21:29:38 jeremy Exp $ +$Id: CHANGELOG.txt,v 1.2.2.40.2.176.2.41.2.101 2009/08/05 00:13:37 jeremy Exp $ + +August 4th, 2009 + - ad.module + o bug #527658: don't require user to choose ad type if only one is available + o bug #445264: fix jQuery display method + +July 29th, 2009 + - click_filter.module + o bug #433432: only query ad_owners table if the ad_owners module is enabled + Patch thanks to mehmeta + o feature #519784: consider user agents with 'spider' or 'crawl' to be bots + Patch thanks to pebosi + - ad_channel.module + o bug #511762: properly document accepted paths for configuring channels + o bug #499522: document shortcoming regarding url aliases + - ad.module + o bug #496406: don't display body field if disabled + Patch thanks to perarnet + +July 28th, 2009 + - ad_channel.install + o bug #532262: add missing ad_channel_remnant table definition July 17th, 2009 - ad_channel.module
--- a/documentation/README.txt Mon Jul 20 13:54:40 2009 +0000 +++ b/documentation/README.txt Fri Sep 11 11:10:20 2009 +0000 @@ -72,7 +72,9 @@ text will be displayed when people hover their mouse pointer over the advertisement. Finally, you need to scroll down to the File attachements section of the page and click the Browser button to select your image, then - click Attach to upload the image. + click Attach to upload the image. If you upload multiple images, the first + image with "List" checked will be displayed. If no images have "List" checked + then no images will be displayed. HTML ads: ---------
--- a/embed/ad_embed.info Mon Jul 20 13:54:40 2009 +0000 +++ b/embed/ad_embed.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Embed ads in content. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/external/ad_external.info Mon Jul 20 13:54:40 2009 +0000 +++ b/external/ad_external.info Fri Sep 11 11:10:20 2009 +0000 @@ -4,9 +4,9 @@ dependencies[] = ad description = Enhances the ad module to support externally hosted ads. Typically combined with IFrames. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/html/ad_html.info Mon Jul 20 13:54:40 2009 +0000 +++ b/html/ad_html.info Fri Sep 11 11:10:20 2009 +0000 @@ -4,9 +4,9 @@ dependencies[] = ad description = Enhances the ad module to support html-based ads, such as those defined by many advertising affiliate websites. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/image/ad_image.info Mon Jul 20 13:54:40 2009 +0000 +++ b/image/ad_image.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ dependencies[] = upload description = Enhances the ad module to support banner ads. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/notify/ad_notify.info Mon Jul 20 13:54:40 2009 +0000 +++ b/notify/ad_notify.info Fri Sep 11 11:10:20 2009 +0000 @@ -6,9 +6,9 @@ description = Receive email notifications regarding ads. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/owners/ad_owners.info Mon Jul 20 13:54:40 2009 +0000 +++ b/owners/ad_owners.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Enhances the ad module to support ad owners. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/remote/ad_remote.info Mon Jul 20 13:54:40 2009 +0000 +++ b/remote/ad_remote.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Generates cut-and-paste source snippets allowing ads to be easily displayed on remote websites. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/remote/ad_remote.module Mon Jul 20 13:54:40 2009 +0000 +++ b/remote/ad_remote.module Fri Sep 11 11:10:20 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: ad_remote.module,v 1.1.4.5.2.5.2.5 2009/03/05 00:35:56 jeremy Exp $ +// $Id: ad_remote.module,v 1.1.4.5.2.5.2.6 2009/08/05 00:13:37 jeremy Exp $ /** * @file @@ -96,7 +96,7 @@ $output = '<!--'. t('start') .'-->'; // build a wrapper script which collects the url the ad is displayed on $output .= "\n<script language='JavaScript' type='text/javascript'>\n var adurl = window.location.href;\n"; - $url = ad($group, $quantity, array('hostid' => $hostid, 'div' => FALSE)); + $url = ad($group, $quantity, array('hostid' => $hostid, 'ad_display' => 'javascript')); // break up the inner script so the browser doesn't parse it $url = str_replace(array('<script', '</script>', 'u=admin/content/ad/ad_remote'), array('"<scr" + "ipt', '"+"</scr" + "ipt>"', 'u="+adurl+"'), $url); $output .= "document.write($url)\n</script>\n";
--- a/report/ad_report.info Mon Jul 20 13:54:40 2009 +0000 +++ b/report/ad_report.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Provides comprehensive charts and reports about advertising statistics. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/statistics/click_filter/click_filter.info Mon Jul 20 13:54:40 2009 +0000 +++ b/statistics/click_filter/click_filter.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Filter duplicate click statistics. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/statistics/click_filter/click_filter.module Mon Jul 20 13:54:40 2009 +0000 +++ b/statistics/click_filter/click_filter.module Fri Sep 11 11:10:20 2009 +0000 @@ -1,5 +1,5 @@ <?php -// $Id: click_filter.module,v 1.1.2.3.2.6 2009/02/16 23:12:30 jeremy Exp $ +// $Id: click_filter.module,v 1.1.2.3.2.6.2.2 2009/07/29 22:18:00 jeremy Exp $ /** * @file @@ -63,13 +63,15 @@ if (user_access('filter clicks')) { return CLICK_FILTER_ROLE; } - if (preg_match("/bot/i", $_SERVER['HTTP_USER_AGENT'])) { + if (preg_match('/bot|crawl|spider/i', $_SERVER['HTTP_USER_AGENT'])) { return CLICK_BOT; } // See if the click came from an owner of the ad. - $result = db_query('SELECT oid FROM {ad_owners} WHERE aid = %d AND uid = %d', $aid, $user->uid); - if (db_result($result)) { - return CLICK_OWNER; + if (module_exists('ad_owners')) { + $result = db_query('SELECT oid FROM {ad_owners} WHERE aid = %d AND uid = %d', $aid, $user->uid); + if (db_result($result)) { + return CLICK_OWNER; + } } // See if the click came from a duplicate uid or ip address. if ($user->uid) {
--- a/text/ad_text.info Mon Jul 20 13:54:40 2009 +0000 +++ b/text/ad_text.info Fri Sep 11 11:10:20 2009 +0000 @@ -4,9 +4,9 @@ dependencies[] = ad description = Enhances the ad module to support static text ads. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"
--- a/weight/probability/ad_weight_probability.info Mon Jul 20 13:54:40 2009 +0000 +++ b/weight/probability/ad_weight_probability.info Fri Sep 11 11:10:20 2009 +0000 @@ -5,9 +5,9 @@ description = Allow admin to adjust the probability that an ad will be displayed. core = 6.x -; Information added by drupal.org packaging script on 2009-07-17 -version = "6.x-2.1-rc1" +; Information added by drupal.org packaging script on 2009-08-05 +version = "6.x-2.1" core = "6.x" project = "ad" -datestamp = "1247867595" +datestamp = "1249431906"