--- banner.module	2004-10-27 22:47:14.000000000 -0400
+++ /home/http/html/modules/banner.module	2004-10-30 14:22:54.595632822 -0400
@@ -1,5 +1,5 @@
 <?php
-// $Id: banner.module,v 1.40 2004/10/28 02:47:14 jeremy Exp $
+// $Id: banner.module,v 1.39 2004/08/17 00:42:16 jeremy Exp $
 
 function banner_help($section) {
   switch($section) {
@@ -669,7 +669,7 @@
                  array('data' => t('title')),
                  array('data' => t('owner')),
                  array('data' => t('status')),
-                 array('data' => t('position')),
+                 array('data' => t('group')),
                  array('data' => t('link')),
                  array('data' => t('created')),
                  );
@@ -761,7 +761,7 @@
   $group .= form_textfield(t('URL'), 'url', $edit['url'], 80, 255, t('Target URL for this banner.'));
   $group .= form_select(t('Status'), 'status', $edit['status'], _banner_status(), t('Status of banner.  A \'pending\' banner requires administrative approval before it will be displayed.  An \'enabled\' banner is approved and actively being displayed. A \'disabled\' banner is approved but disabled by the user.  A \'blocked\' banner is approved but disabled by the admin, for example after being displayed \'max views\' times.  A \'denied\' banner was not approved by the admin.'));
   $group .= form_textfield(t('Owner'), 'uid', $edit['uid'], 5, 10, t('Optional UID of site user that own this banner.  This user will be able to view banner statistics.'));
-  $group .= form_select(t('Position'), 'position', $edit['position'], range(0,9), t('Position of this banner in the page.'));
+  $group .= form_select(t('Group'), 'position', $edit['position'], range(0,9), t('Which group this banner belongs in.  Each group can be displayed in a different position on your web page, as defined by your theme.'));
   $group .= form_textfield(t('Automatically publish banner'), 'publish_date', ($edit['publish_date'] ? format_date((int)$edit['publish_date']) : ''), 30, 55, t('The date at which this banner will be automatically published.  Leave empty if you don\'t want to schedule this banner, or fill out a string containing an English date format.  Example input:') . " '". date('j F Y G:i') ."', '". date('m/d/y H:i') ."', '". date('F j, Y H:i') ."', ...");
   $group .= form_textfield(t('Automatically unpublish banner'), 'unpublish_date', ($edit['unpublish_date'] ? format_date((int)$edit['unpublish_date']) : ''), 30, 55, t('The date at which this banner will be automatically unpublished.  Leave empty if you don\'t want to schedule this banner, or fill out a string containing an English date format.  Example input:') . " '". date('j F Y G:i') ."', '". date('m/d/y H:i') ."', '". date('F j, Y H:i') ."', ...");
   $form .= $group;
@@ -892,11 +892,12 @@
 function banner_overview() {
 
   $headers = array(
+    array('data' => t('id'), 'field' => 'id'),
     array('data' => t('title'), 'field' => 'title'),
     array('data' => t('url'), 'field' => 'url'),
     array('data' => t('status'), 'field' => 'status', 'sort' => 'asc'),
     array('data' => t('owner'), 'field' => 'id'),
-    array('data' => t('position'), 'field' => 'position'),
+    array('data' => t('group'), 'field' => 'position'),
     array('data' => t('views'), 'field' => 'views'),
     array('data' => t('clicks'), 'field' => 'clicks'),
     array('data' => t('options'))
@@ -908,6 +909,7 @@
   $result = pager_query($sql, 20);
   while ($banner = db_fetch_object($result)) {
     $row = array();
+    $row[] = $banner->id;
     $row[] = $banner->title;
     $row[] = $banner->url;
     $row[] = _banner_status($banner->status);
@@ -1050,7 +1052,7 @@
     $banners[$banner->id]->week_max_views = $banner->week_max_views;
     $banners[$banner->id]->max_views = $banner->max_views;
     $banners[$banner->id]->filename = file_create_url($banner->file);
-    $banners[$banner->id]->html = "document.write('".str_replace(array("'", "\n", "\r"), array("\'", " ", " "), _banner_show($banner))."')";
+    $banners[$banner->id]->html = "document.write('".str_replace(array("'", "\n", "\r"), array("\'", " ", " "), theme('banner_show', $banner))."')";
   }
 
   if ($banners) {
@@ -1100,18 +1102,18 @@
 /**
 * Get banner html
 *
-* Returns some html code to show a banner in a given position.
-* Call this function from your theme, use positions in different places.
+* Returns some html code to show a banner in a given group.
+* Call this function from your theme, use groups in different places.
 *
-* @param integer $position position of the banner in the theme
+* @param integer $group group of the banner in the theme
 * @return string proper HTML to show the banner
 */
-function banner_display($position) {
+function banner_display($group = 0) {
   global $base_url;
  
   if (user_access('show banners')) {
     $files = array('banner_db.php', 'banner_file.php');
-    $file = $files[variable_get('banner_cache', '0')] ."?pos=$position&amp;key=". variable_get('banner_cache_key', '1');
+    $file = $files[variable_get('banner_cache', '0')] ."?pos=$group&amp;key=". variable_get('banner_cache_key', '1');
     return '<script type="text/javascript" language="javascript" src="'."$base_url/$file".'"></script>';
   }
 }
@@ -1137,17 +1139,17 @@
 function _banner_handle_upload(&$fields, &$edit) {
   if ($file = file_save_upload('path', file_create_path(variable_get('banner_image_path', 'banners')))) {
     $fields[] = 'path';
-    $edit['path'] = $file->path;
+    $edit['path'] = $file->filepath;
     $fields[] = 'format';
-    switch (_banner_type($file->type)) {
+    switch (_banner_type($file->filemime)) {
       // We support the following file types
       case 'image':
       case 'swf':
       default:
         $fields[] = 'width';
         $fields[] = 'height';
-        list($edit['width'], $edit['height']) = getimagesize($file->path);
-        $edit['format'] = $file->type;
+        list($edit['width'], $edit['height']) = getimagesize($file->filepath);
+        $edit['format'] = $file->filemime;
         break;
       // Otherwise assume it's text...
       case 'text':
