Index: acidfree.module =================================================================== --- acidfree.module (revision 343) +++ acidfree.module (working copy) @@ -119,6 +119,26 @@ * to our module. */ function acidfree_init() { + global $acidfree_types; + $acidfree_types = variable_get('acidfree_types', array()); + if (!$acidfree_types) { + $acidfree_base = drupal_get_path('module', 'acidfree'); + foreach (glob($acidfree_base.DIRECTORY_SEPARATOR.'class_*.inc') as $classfile) { + require_once($classfile); + $type = acidfree_call(basename($classfile, ".inc") . "_register"); + if ($type->class) + $acidfree_types[$type->class] = $type; + } + variable_set('acidfree_types', $acidfree_types); + } else { + $acidfree_base = drupal_get_path('module', 'acidfree'); + foreach ($acidfree_types as $name => $class) { + require_once($acidfree_base.DIRECTORY_SEPARATOR."class_{$name}.inc"); + } + $class_debug = $acidfree_base.DIRECTORY_SEPARATOR.'class_debug.inc'; + if (file_exists($class_debug)) + require_once($class_debug); + } } /** @@ -180,17 +200,6 @@ // acidfree_init stuff $create_acidfree_elements = false; $have_default = false; - $acidfree_types = variable_get('acidfree_types', array()); - if (!$acidfree_types) { - $acidfree_base = drupal_get_path('module', 'acidfree'); - foreach (glob($acidfree_base.DIRECTORY_SEPARATOR.'class_*.inc') as $classfile) { - require_once($classfile); - $type = acidfree_call(basename($classfile, ".inc") . "_register"); - if ($type->class) - $acidfree_types[$type->class] = $type; - } - variable_set('acidfree_types', $acidfree_types); - } foreach ($acidfree_types as $type => $class) { $class_access = user_access($class->access); $create_acidfree_elements |= $class_access; @@ -225,16 +234,6 @@ theme_add_style("$acidfree_base/acidfree.css"); } - $acidfree_types = variable_get('acidfree_types', array()); - if ($acidfree_types) { - foreach ($acidfree_types as $name => $class) { - require_once($acidfree_base.DIRECTORY_SEPARATOR."class_{$name}.inc"); - } - } - $class_debug = $acidfree_base.DIRECTORY_SEPARATOR.'class_debug.inc'; - if (file_exists($class_debug)) - require_once($class_debug); - $path = explode('/', $_GET['q']); if ($path[0] == 'node' && is_numeric($path[1])) { $node = acidfree_get_node_by_id($path[1]); @@ -247,6 +246,13 @@ 'type' => MENU_LOCAL_TASK); } } + if (variable_get('acidfree_per_user_albums', false) && $user->uid > 0) { + $items[] = array('path' => 'user/acidfree', 'title' => t('My Acidfree Albums'), + 'access' => user_access('create acidfree albums'), + 'callback' => 'acidfree_page', + 'type' => MENU_SUGGESTED_ITEM, + ); + } } return $items; } @@ -255,12 +261,28 @@ acidfree_call('_class_video_manipulation_options_validate', array($form_values)); } +function _acidfree_can_create() { + $menu = menu_get_menu(); + $mid = $menu['path index']['node/add/acidfree']; + return $menu['items'][$mid]['access']; +} + /** * Implementation of hook_settings */ function acidfree_settings() { $form = array(); $form['#validate'] = array('acidfree_settings_validate' => array()); + $form['general'] = array( + '#type' => 'fieldset', + '#title' => t('General Settings'), + ); + $form['general']['acidfree_per_user_albums'] = array( + '#type' => 'checkbox', + '#title' => t('Per user albums'), + '#description' => t('This options will allow each user to have a top-level album of their own. The per user album is located at user/acidfree if logged in and acidfree/nnn for each individual album.'), + '#default_value' => variable_get('acidfree_per_user_albums', false), + ); $rows = drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); $cols = drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); $resize_count = drupal_map_assoc(array(10, 20, 50, 100, 200, 500)); @@ -505,6 +527,7 @@ } $perms[] = 'edit own acidfree elements'; $perms[] = 'acidfree mass import'; + $perms[] = 'can upload to any album'; return $perms; } @@ -673,6 +696,7 @@ } break; case t('Move'): + $n->parent = is_array($n->parent)?array_keys($n->parent):$n->parent; // replace node->nid with dest->nid in parent list if ($n->class != 'album') { for ($p=0; $pparent); $p++) { @@ -952,6 +976,12 @@ else $parent = acidfree_get_root(false); $output .= _acidfree_import_form($parent); + } elseif ($path == 'user/acidfree' && + variable_get('acidfree_per_user_albums', 0)) { + $node = acidfree_get_user_root(); + if (!$node) + return drupal_not_found(); + drupal_goto("node/{$node->nid}"); } elseif (preg_match('@node/([0-9]*)/contents@', $path, $matches)) { $node = acidfree_get_node_by_id($matches[1]); drupal_set_title(t('Album Contents')); @@ -966,6 +996,11 @@ return drupal_access_denied(); } $output .= acidfree_test(--$argc, $argv); + } else if ($argc == 1 && is_numeric($argv[0])) { + $node = acidfree_get_user_root($argv[0]); + if (!$node) + return drupal_not_found(); + drupal_goto("node/{$node->nid}"); } else { drupal_not_found(); //gotto(__LINE__); @@ -1050,20 +1085,19 @@ && $path[2] == 'acidfree' && is_numeric(arg(4))) { $node->parent = Array(arg(4)); } - $children = acidfree_get_album_tree($node); - // An album can't be the child of itself, nor of its children. - foreach ($children as $child) { - $exclude[] = $child->nid; - } - $exclude[] = $node->nid; + if ($node->class == 'album') { + $children = acidfree_get_album_tree($node); - if ($node->class == 'album') { + // An album can't be the child of itself, nor of its children. + foreach ($children as $child) { + $exclude[] = $child->nid; + } $form['parent'] = _acidfree_parent_select(t('Parent album'), $node->parent, l(t('Parent album'), 'admin/help/acidfree', NULL, NULL, 'parent') .'.', 0, $exclude); } else { $form['parent'] = _acidfree_parent_select(t('Parent albums'), $node->parent, - l(t('Parent albums'), 'admin/help/acidfree', NULL, NULL, 'parent') .'.', 1, $exclude); + l(t('Parent albums'), 'admin/help/acidfree', NULL, NULL, 'parent') .'.', 1); } } else { $form['parent'] = array( @@ -1111,19 +1145,39 @@ // a better way to tell the validator than modifying the $_POST variable. if (isset($_POST['edit'])) $_POST['edit']['acidfreeupload'] = 'file'; + if ($node->class) { + // validate the parent(s) + $pcount = count($node->parent); + for ($i = 0; $i<$pcount; $i++) { + $p = acidfree_get_node_by_id($node->parent[$i]); + if (!node_access('update', $p) && !$p->share) { + drupal_set_message(t('You are not allowed to add a %item to %album', array('%item' => $node->class, '%album' => $p->title)), 'error'); + unset($node->parent[$i]); + } + } + if (count($node->parent) == 0) { + form_set_error('parent', 'you must select a parent album'); + } + } } -function _acidfree_create_root() { +function _acidfree_create_root($title, $parent) { + if ($parent == -1) { + $uid = 1; + } else { + global $user; + $uid = $user->uid; + } $node = Array( - 'title' => 'Acidfree Albums', + 'title' => $title, 'body' => '', 'teaser' => '', - 'uid' => 1, + 'uid' => $uid, 'class' => 'album', 'type' => 'acidfree', 'status' => 1, 'weight' => -30, - 'parent' => Array(-1), + 'parent' => Array($parent), ); $node = (object)$node; node_save($node); @@ -1133,8 +1187,9 @@ function acidfree_get_root($id_only=true) { static $root_id = null; if ($root_id == null) { - $result = db_query("SELECT child FROM {acidfree_hierarchy} WHERE parent='-1'"); - $result = _acidfree_fix_root($result); + $query_function = create_function('', + "return db_query('SELECT child FROM {acidfree_hierarchy} WHERE parent=\'-1\'');"); + $result = _acidfree_fix_root($query_function, t('Acidfree Albums'), -1); $row = db_fetch_array($result); $root_id = $row['child']; } @@ -1143,14 +1198,44 @@ return acidfree_get_node_by_id($root_id); } +function acidfree_get_user_root($uid=0) { + global $user; + if ((!$user || !$user->uid) && !$uid) { + return null; + } elseif (!$uid || ($uid == $user->uid)) { + $uid = $user->uid; + $fix = true; + $uname = $user->name; + } else { + $fix = false; + $uname = db_result(db_query('SELECT name FROM {users} WHERE uid=%d', $uid)); + if (!$uname) + return null; + } + $root = acidfree_get_root(); + if (!isset($user->acidfree)) { + $query_function = create_function('', + "return db_query('SELECT nid FROM {node} JOIN {acidfree} ON nid=aid '. + 'JOIN {acidfree_hierarchy} ON aid=child '. + 'WHERE parent=\'%d\' AND uid=\'%d\'', $root, $uid);"); + $result = _acidfree_fix_root($query_function, + t('%s\'s Albums', array('%s'=>$uname)), $root, $fix); + $row = db_fetch_array($result); + $root_id = $row['nid']; + } + if ($id_only) + return $root_id; + return acidfree_get_node_by_id($root_id); +} + function acidfree_get_album_tree(&$node, $depth=0) { $tree = Array(); if (!isset($node->nid)) return $tree; $children = _acidfree_get_child_albums($node); + $tree[] = $node; foreach ($children as $child) { $child->depth = $depth; - $tree[] = $child; $tree = array_merge($tree, acidfree_get_album_tree($child, $depth + 1)); } return $tree; @@ -1233,7 +1318,7 @@ $valid[$root->nid] = 1; } $tree = acidfree_get_album_tree($root); - if ($tree) { + if (count($tree) > 1) { foreach ($tree as $album) { // TODO: I am not sure if duplicates are ever possible, but assume they are and drop them as the come $valid[$album->nid] = 1; @@ -1264,7 +1349,9 @@ } $updates = acidfree_call($acidfree_types[$node->class]->update, array(&$node)); - db_query("UPDATE {acidfree} SET $updates WHERE aid = %d", $node->nid); + $unames = implode(',', $updates['names']); + $updates['values'][] = $node->nid; + db_query("UPDATE {acidfree} SET $unames WHERE aid = %d", $updates['values']); if ($update_parent) { db_query("DELETE FROM {acidfree_hierarchy} WHERE child = %d", $node->nid); if (!is_array($node->parent)) @@ -1307,6 +1394,8 @@ * every time a node is loaded, and allows us to do some loading of our own. */ function acidfree_load(&$node) { + require_once('class_debug.inc'); + global $acidfree_types; $additions = db_fetch_object(db_query("SELECT class,large,small,thumb,weight,visited,votes FROM {acidfree} WHERE aid = %d", $node->nid)); $result = db_query("SELECT parent FROM {acidfree_hierarchy} WHERE child = %d", $node->nid); while ($p = db_fetch_object($result)) { @@ -1318,6 +1407,11 @@ if ($additions->class == 'album') $additions->weight += 30; + $per_class = acidfree_call($acidfree_types[$additions->class]->load, array(&$node, &$additions)); + if ($additions->class == 'album') + if (is_array($per_class)) + $additions = array_merge($additions, $per_class); + return $additions; } @@ -1721,28 +1815,33 @@ // this is a wacky function that accepts a possibly broken // root album query result and returns a fixed one -function _acidfree_fix_root($result) { +function _acidfree_fix_root($query_function, $title, $parent, $fix=true) { + $result = $query_function(); $count = db_num_rows($result); switch ($count) { case 1: return $result; case 0: - $root = _acidfree_create_root(); + if (!$fix) + return null; + $root = _acidfree_create_root($title, $parent); $msg = "No Acidfree root album found, created new root -- node $root"; $wd = WATCHDOG_NOTICE; $ml = 'status'; break; default: + if (!$fix) + return null; $node = new stdClass(); $node->nid = -1; - $items = _acidfree_get_children($node); $children = Array(); - foreach ($items as $item) { + while ($item = db_fetch_object($result)) { $children[] = $item->nid; } $children = implode(",", $children); - $root = _acidfree_create_root(); - db_query("UPDATE {acidfree_hierarchy} SET parent=$root WHERE parent=-1 AND child IN ($children)"); + $root = _acidfree_create_root($title, $parent); + db_query("UPDATE {acidfree_hierarchy} SET parent=%d WHERE parent=%d AND child IN (%s)", + $root, $parent, $children); $msg = "Found $count Acidfree root albums, new root is node $root"; $wd = WATCHDOG_ERROR; $ml = 'error'; @@ -1750,7 +1849,7 @@ } watchdog("Acidfree", $msg, $wd, l('edit', "node/$root/edit")." ".l('view', "node/$root")); drupal_set_message($msg, $ml); - return db_query("SELECT child FROM {acidfree_hierarchy} WHERE parent='-1'"); + return $query_function(); } /* tags we recognize: @@ -1839,23 +1938,39 @@ } function _acidfree_parent_select($title, $value, $description, $multiple, $exclude = array(), $extra = array()) { + $any_album = user_access('can upload to any album'); $root = acidfree_get_root(false); + $root->title = '<'.t('Root').'>'; $tree = acidfree_get_album_tree($root); - if ($root->nid) { - $options[$root->nid] = '<'.t('Root').'>'; - } + if (!is_array($value)) + $value = array($value); - if ($tree) { - foreach ($tree as $album) { - if (!in_array($album->nid, $exclude)) { - $options[$album->nid] = str_repeat('-', $album->depth) . $album->title; - } - } - if (!$value) { - $value = $root->nid; - } - } + if (count($tree) > 1) { + // if the user cannot upload to *any* album (other than his own), + // then exclude all albums he did not create + if (!$any_album) { + global $user; + $query = "SELECT n.nid FROM {node} n + LEFT JOIN {acidfree} a + ON n.nid = a.aid + WHERE a.class='album' AND n.uid!=%d AND a.share=0"; + $resource = db_query($query, $user->uid); + while ($result = db_fetch_array($resource)){ + $exclude[] = $result['nid']; + } + } + foreach ($tree as $album) { + if (in_array($album->nid, $value) || (!in_array($album->nid, $exclude) && + (node_access('update', $album) || $any_album || $album->share))) { + $options[$album->nid] = str_repeat('-', $album->depth) . $album->title; + } + } + if (!$value) { + $value = $root->nid; + } + } + if ($options) { if ($multiple) @@ -1903,7 +2018,7 @@ $clauses = "FROM {node} n INNER JOIN {acidfree} on n.nid = {acidfree}.aid ". "INNER JOIN {acidfree_hierarchy} ON {acidfree_hierarchy}.child = {acidfree}.aid ". "WHERE (n.moderate = 0 AND n.status = 1) AND parent = {$node->nid} $where_class ". - _acidfree_content_sort_clause(); + _acidfree_content_sort_clause($node); $query = db_rewrite_sql("SELECT n.nid " . $clauses); $count_query = db_rewrite_sql("SELECT count(n.nid) " . $clauses); if ($limit == -1) { @@ -1931,7 +2046,7 @@ "INNER JOIN {acidfree} ON n.nid = {acidfree}.aid ". "INNER JOIN {acidfree_hierarchy} ON {acidfree_hierarchy}.child = {acidfree}.aid ". "WHERE (n.moderate = 0 AND n.status = 1) AND parent = {$node->nid} AND class='album' ". - _acidfree_content_sort_clause(); + _acidfree_content_sort_clause($node); $query = db_rewrite_sql($query); $kids = db_query($query); while ($kid = db_fetch_array($kids)) { @@ -1948,7 +2063,7 @@ "INNER JOIN {acidfree} ON n.nid = {acidfree}.aid ". "INNER JOIN {acidfree_hierarchy} ON {acidfree_hierarchy}.child = {acidfree}.aid ". "WHERE (n.moderate = 0 AND n.status = 1) AND parent = {$node->nid} AND class='album' ". - _acidfree_content_sort_clause(); + _acidfree_content_sort_clause($node); $query = db_rewrite_sql($query); $count = db_result(db_query($query)); return $count; @@ -2031,7 +2146,7 @@ "INNER JOIN {acidfree} ON {acidfree}.aid = n.nid ". "INNER JOIN {acidfree_hierarchy} ON child = aid ". "WHERE (n.moderate = 0 AND n.status = 1) AND class <> 'album' AND parent=%d ". - "AND " . _acidfree_filter_clause('n') . " < '" . _acidfree_filter_clause($node) . "'"; + "AND " . _acidfree_filter_clause($parent, 'n') . " < '" . _acidfree_filter_clause($parent, $node) . "'"; $query = db_rewrite_sql($query); $res = db_query($query, $parent->nid); @@ -2524,8 +2639,8 @@ * This code can be expanded in the future to support additional sorting criteria */ -function _acidfree_content_sort_clause() { - $order = _acidfree_content_sort_array(); +function _acidfree_content_sort_clause(&$album) { + $order = _acidfree_content_sort_array($album); $sort = array(); foreach ($order as $k => $v) { @@ -2567,8 +2682,8 @@ -function _acidfree_filter_clause($node_data = 'n', $acidfree_table = '{acidfree}') { - $order = _acidfree_content_sort_array(); +function _acidfree_filter_clause(&$album, $node_data = 'n', $acidfree_table = '{acidfree}') { + $order = _acidfree_content_sort_array($album); // If a node is passed the class returned will be a normal string if (is_object($node_data)) { @@ -2598,7 +2713,7 @@ $filter[] = str_pad(9999999999 - $node_data->nid, 10, '0', STR_PAD_LEFT); } else { - $filter[] = "LPAD(CONVERT(9999999999 - {$acidfree_table}.aid, CHAR), 10, '0')"; + $filter[] = "LPAD(CONVERT(9999999999 - {{$acidfree_tablea}}.aid, CHAR), 10, '0')"; } } else { @@ -2606,7 +2721,7 @@ $filter[] = str_pad($node_data->nid, 10, '0', STR_PAD_LEFT); } else { - $filter[] = "LPAD(CONVERT({$acidfree_table}.aid, CHAR), 10, '0')"; + $filter[] = "LPAD(CONVERT({{$acidfree_tablea}}.aid, CHAR), 10, '0')"; } } break; @@ -2618,7 +2733,7 @@ $filter[] = str_pad(5555555555 - $node_data->weight, 10, '0', STR_PAD_LEFT); } else { - $filter[] = "LPAD(CONVERT(5555555555 - {$acidfree_table}.weight, CHAR), 10, '0')"; + $filter[] = "LPAD(CONVERT(5555555555 - {{$acidfree_tablea}}.weight, CHAR), 10, '0')"; } } else { @@ -2626,7 +2741,7 @@ $filter[] = str_pad(5555555555 + $node_data->weight, 10, '0', STR_PAD_LEFT); } else { - $filter[] = "LPAD(CONVERT(5555555555 + {$acidfree_table}.weight, CHAR), 10, '0')"; + $filter[] = "LPAD(CONVERT(5555555555 + {{$acidfree_table}}.weight, CHAR), 10, '0')"; } } break; @@ -2646,10 +2761,26 @@ } // TODO: In the future this will lookup settings and allow for more complex sorts -function _acidfree_content_sort_array() { - // For now order is fixed. Someday this may come from settings - // - In PHP the array is maintained in added order - return array( 'weight' => 'ASC', 'aid' => variable_get('acidfree_order', 'DESC')); +function _acidfree_content_sort_array(&$album) { + // For now order is fixed. Someday this may come from settings + // - In PHP the array is maintained in added order + $order = array('weight' => 'ASC'); + switch ($album->sort) { + case 'iage': + $order['aid'] = 'DESC'; + break; + case 'age': + $order['aid'] = 'ASC'; + break; + case 'alpha': + $order['title'] = 'DESC'; + break; + case 'global': + default: + $order['aid'] = variable_get('acidfree_order', 'DESC'); + break; + } + return $order; } function acidfree_pager_creator(&$node) { @@ -2701,6 +2832,8 @@ static $offset_lookup = array(); static $pid_lookup = array(); + $parent = acidfree_get_node_by_id($acidfree_pid); + // Get page elements $pager = explode(',', $matches[2]); if (count($pager) < ELEMENT_PAGER+1) @@ -2712,7 +2845,7 @@ $clauses = "SELECT n.nid FROM {node} n INNER JOIN {acidfree} on n.nid = {acidfree}.aid ". "INNER JOIN {acidfree_hierarchy} ON {acidfree_hierarchy}.child = {acidfree}.aid ". "WHERE (n.moderate = 0 AND n.status = 1) AND parent = %d AND class <> 'album' ". - _acidfree_content_sort_clause() . + _acidfree_content_sort_clause($parent) . " LIMIT %d,1"; $query = db_rewrite_sql($clauses); $nid = db_result(db_query($query, $acidfree_pid, $offset)); Index: class_photo.inc =================================================================== --- class_photo.inc (revision 342) +++ class_photo.inc (working copy) @@ -111,7 +111,21 @@ module_invoke('filemanager', 'promote_working', $small); module_invoke('filemanager', 'promote_working', $thumb); } - return "weight='{$node->weight}'"; + $per_class = array( + 'names' => array( + "weight=%d", + "large='%s'", + "small='%s'", + "thumb='%s'", + ), + 'values' => array( + $node->weight, + $node->large, + $node->small, + $node->thumb, + ), + ); + return $per_class; } function _class_photo_form($op, &$node) { Index: class_album.inc =================================================================== --- class_album.inc (revision 342) +++ class_album.inc (working copy) @@ -34,6 +34,7 @@ $class->mime_ext = Array(); $class->create = '_class_album_create'; $class->update = '_class_album_update'; + $class->load = '_class_album_load'; $class->form = '_class_album_form'; $class->destroy = '_class_album_destroy'; $class->access = 'create acidfree albums'; @@ -43,6 +44,11 @@ function _class_album_create(&$node, &$file) { $node->thumb = ''; $node->weight -= 30; + $extras = array( + 'sort' => $node->sort, + 'share' => $node->share, + ); + $node->small = serialize($extras); } function _class_album_update(&$node) { @@ -50,9 +56,33 @@ $node->thumb = ''; } $node->weight -= 30; - return "weight='{$node->weight}', thumb='{$node->thumb}'"; + $extras = array( + 'sort' => $node->sort, + 'share' => $node->share, + ); + $extras = serialize($extras); + $per_class = array( + 'names' => array( + "weight=%d", + "small='%s'", + "thumb='%s'", + ), + 'values' => array( + $node->weight, + $extras, + $node->thumb, + ), + ); + return $per_class; } +function _class_album_load(&$node, &$additions) { + $extras = unserialize($additions->small); + if (!is_array($extras)) + $extras = array(); + return $extras; +} + function _class_album_form($op, &$node) { $form = array(); switch ($op) { @@ -91,6 +121,23 @@ '#attributes' => array('onchange' => "set_thumb(this, {$node->nid}, ".count($children).");"), '#acidfree_form' => true, ); + $sort_options = array( + 'global' => t('Use global setting'), + 'iage' => t('Most recent first'), + 'age' => t('Chronologically'), + 'alpha' => t('Alphabetically'), + ); + $form['sort'] = array( + '#type' => 'select', + '#title' => t('Sort this album by'), + '#default_value' => $node->sort, + '#options' => $sort_options, + ); + $form['share'] = array( + '#type' => 'checkbox', + '#title' => t("Allow others to post items to this album"), + '#default_value' => $node->share, + ); break; } return $form; @@ -158,7 +205,7 @@ function theme_acidfree_print_full_album($node) { $ncols = variable_get('acidfree_cols', 5); $nrows = variable_get('acidfree_rows', 3); - $show_box = node_access('update', $node); + $show_box = node_access('update', $node) || (_acidfree_can_create() && $node->share); $nodes_per_page = $ncols*$nrows - ($show_box ? 1 : 0); $nodes = _acidfree_get_children($node, $nodes_per_page, ALBUM_PAGER); if (count($nodes) == 0) Index: class_video.inc =================================================================== --- class_video.inc (revision 342) +++ class_video.inc (working copy) @@ -144,7 +144,21 @@ } function _class_video_update(&$node) { - return "weight='{$node->weight}'"; + $per_class = array( + 'names' => array( + "weight=%d", + "large='%s'", + "small='%s'", + "thumb='%s'", + ), + 'values' => array( + $node->weight, + $node->large, + $node->small, + $node->thumb, + ), + ); + return $per_class; } function _class_video_form($op, &$node) { Index: acidfree.install =================================================================== --- acidfree.install (revision 342) +++ acidfree.install (working copy) @@ -58,4 +58,7 @@ return _system_update_utf8(array('acidfree', 'acidfree_hierarchy')); } +function acidfree_update_2() { + return db_query("ALTER TABLE {acidfree} ADD share TINYINT(1) NOT NULL DEFAULT '0'"); +} ?>