Index: .htaccess =================================================================== RCS file: /cvs/drupal/drupal/.htaccess,v retrieving revision 1.74 diff -u -r1.74 .htaccess --- .htaccess 1 May 2006 08:32:56 -0000 1.74 +++ .htaccess 1 Jun 2006 06:10:43 -0000 @@ -68,7 +68,7 @@ # Modify the RewriteBase if you are using Drupal in a subdirectory and # the rewrite rules are not working properly. - #RewriteBase /drupal + RewriteBase /~lgarfiel/eclipse/drupal # Rewrite old-style URLs of the form 'node.php?id=x'. #RewriteCond %{REQUEST_FILENAME} !-f Index: INSTALL.txt =================================================================== RCS file: /cvs/drupal/drupal/INSTALL.txt,v retrieving revision 1.32 diff -u -r1.32 INSTALL.txt --- INSTALL.txt 26 May 2006 09:21:10 -0000 1.32 +++ INSTALL.txt 1 Jun 2006 06:10:43 -0000 @@ -118,24 +118,33 @@ will be removed according to the pattern above if no port-specific configuration is found, just like a real subdomain. - Each site configuration can have its own site-specific modules and - themes that will be made available in addition to those installed - in the standard 'modules' and 'themes' directories. To use - site-specific modules or themes, simply create a 'modules' or - 'themes' directory within the site configuration directory. For - example, if sub.example.com has a custom theme and a custom module - that should not be accessible to other sites, the setup would look + NOTE: for more information about multiple virtual hosts or the + configuration settings, consult the Drupal handbook at drupal.org. + +4. INSTALLING MODULES AND THEMES + + Drupal ships with a number of default modules and themes in the + 'modules' and 'themes' directories, respectively. Additional modules + and themes can be installed by placing them in the "sites" directory + as well. To make a module or theme available to all sites, simply + place a module under the sites/all/modules directory and a theme under + the sites/all/themes directory. To make it available to only one site, + place it in the 'modules' or 'themes' directory within the site + configuration directory. + + For example, to make module_a and theme_a available to all sites, but + module_b and theme_b available only to sub.example.com, the setup would look like this: + sites/all: + themes/theme_a + modules/module_a sites/sub.example.com/: settings.php - themes/custom_theme - modules/custom_module - - NOTE: for more information about multiple virtual hosts or the - configuration settings, consult the Drupal handbook at drupal.org. + themes/theme_b + modules/module_b -4. CONFIGURE DRUPAL +5. CONFIGURE DRUPAL You should consider creating a "files" subdirectory in your Drupal installation directory. This subdirectory stores files such as @@ -156,7 +165,7 @@ Create an account and login. The first account will automatically become the main administrator account with total control. -5. CRON TASKS +6. CRON TASKS Many Drupal modules (such as the search functionality) have periodic tasks that must be triggered by a cron job. To activate these tasks, Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.56 diff -u -r1.56 database.inc --- includes/database.inc 27 Apr 2006 20:38:49 -0000 1.56 +++ includes/database.inc 1 Jun 2006 06:10:44 -0000 @@ -324,8 +324,132 @@ return preg_replace('/[^A-Za-z0-9_]+/', '', $string); } + /** - * @} End of "defgroup database". + * Run an insert query on the active database. + * + * @param $table + * The database table on which to run the insert query. + * @param $fields + * An associative array of the values to insert. The keys are the + * fields, and the corresponding values are the values to insert. + * @return + * A database query result resource, or FALSE if the query was not + * executed correctly. + * + */ +function db_insert($table, $fields) { + + $insert_fields = array_keys($fields); + $insert_values = array_values($fields); + + $params = array(); + foreach ($insert_values as $value) { + $params[] = is_numeric($value) ? '%d' : "'%s'"; + } + + $sql = 'INSERT INTO {' . $table . '} (' . implode(',', $insert_fields) . ') VALUES (' . implode(',', $params) . ')'; + + return db_query($sql, $insert_values); +} + +/** + * Run an update query on the active database. + * + * @param $table + * The database table on which to run the update query. + * @param $fields + * An associative array of the values to update. The keys are the + * fields, and the corresponding values are the values to update to. + * @param $where + * The where rules for this update query. + * @param $where_type + * Whether to AND or OR the where rules together. + * @return + * A database query result resource, or FALSE if the query was not + * executed correctly. + * + */ +function db_update($table, $fields, $where, $where_type='AND') { + + $update_values = array_values($fields); + + $flat_fields = array(); + foreach ($fields as $field => $value) { + $flat_fields[] = $field . '=' . (is_numeric($value) ? '%d' : "'%s'"); + } + + list($where_string, $where_values) = db_where_clause($where, $where_type); + + $sql = 'UPDATE ' . $table . ' SET ' . implode(',', $flat_fields) . $where_string; + + return db_query($sql, array_merge($update_values, $where_values)); +} + +/** + * Run a delete query on the active database. + * + * @param $table + * The database table on which to run the delete query. + * @param $where + * The where rules for this delete query. + * @param $where_type + * Whether to AND or OR the where rules together. + * @return + * A database query result resource, or FALSE if the query was not + * executed correctly. + * + */ +function db_delete($table, $where, $where_type='AND') { + + list($where_string, $where_values) = db_where_clause($where, $where_type); + + $sql = 'DELETE FROM ' . $table . implode(',', $flat_fields) . $where_string; + + return db_query($sql, array_merge($update_values, $where_values)); +} + +/** + * Build the WHERE portion of an SQL query, based on the specified values. + * + * @param $where + * Associative array of rules in the WHERE clause. If a key in the array + * is numeric, the value is taken as a literal rule. If it is non-numeric, + * then it is assumed to be a field name and the corresponding value is the + * value that it must hold. + * @param $where_type + * Whether the values of the WHERE clause should be ANDed or ORed together. + * + * As an example, this $where clause would be translated as follows: + * $where = array('name'=>'foo', 'type'=>'page', 'created < 1147567877') + * + * WHERE (name='foo') AND ('type'='page') AND (created < 1147567877') + * @return + * An array containing the where clause with sprintf() markers, and + * an array of values to substitute for them. */ +function db_where_clause($where, $where_type='AND') { + $params = array(); + $args = array(); + foreach ($where as $key => $value) { + if (is_numeric($key)) { + $params[] = ' (' . $value . ') '; + } + else { + $params[] = ' (' . $key . '=' . (is_numeric($value) ? '%d' : "'%s'") . ') '; + $args[] = $value; + } + } + + $return = ''; + if (sizeof($params)) { + $return = ' WHERE ' . implode($where_type, $params); + } + + return array($return, $args); +} +/** + * @} End of "defgroup database". + */ Index: modules/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact.module,v retrieving revision 1.54 diff -u -r1.54 contact.module --- modules/contact.module 29 May 2006 13:26:41 -0000 1.54 +++ modules/contact.module 1 Jun 2006 06:10:44 -0000 @@ -239,14 +239,22 @@ $recipients[$key] = trim($recipient); } $form_values['recipients'] = implode(',', $recipients); + $fields['category'] = $form_values['category']; + $fields['recipients'] = $form_values['recipients']; + $fields['reply'] = $form_values['reply']; + $fields['weight'] = $form_values['weight']; + $fields['selected'] = $form_values['selected']; if (arg(3) == 'add') { - db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']); + db_insert('contact', $fields); +// db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']); drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact')); } else { - db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']); + $where['cid'] = $form_values['cid']; + db_update('contact', $fields, $where); +// db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']); drupal_set_message(t('Category %category has been updated.', array('%category' => theme('placeholder', $form_values['category'])))); watchdog('mail', t('Contact form: category %category updated.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact')); } Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.327 diff -u -r1.327 system.module --- modules/system.module 16 May 2006 09:22:36 -0000 1.327 +++ modules/system.module 1 Jun 2006 06:10:46 -0000 @@ -671,13 +671,14 @@ } /** - * Returns an array of files objects of the given type from both the - * site-wide directory (i.e. modules/) and site-specific directory - * (i.e. sites/somesite/modules/). The returned array will be keyed - * using the key specified (name, basename, filename). Using name or - * basename will cause site-specific files to shadow files in the - * default directories. That is, if a file with the same name appears - * in both location, only the site-specific version will be included. + * Returns an array of files objects of the given type from the site-wide + * directory (i.e. modules/), the all-sites directory (i.e. sites/all/modules/) + * and site-specific directory (i. e. sites/somesite/modules/). The returned + * array will be keyed using the key specified (name, basename, filename). Using + * name or basename will cause site- specific files to shadow files in the + * default directories. That is, if a file with the same name appears in both + * the site-wide directory and site-specific directory, only the site-specific + * version will be included. * * @param $mask * The regular expression of the files to find. @@ -698,6 +699,8 @@ $searchdir = array($directory); $files = array(); + // Always search sites/all/* as well as the global directories + $searchdir[] = 'sites/all'; if (file_exists("$config/$directory")) { $searchdir[] = "$config/$directory"; } Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.28 diff -u -r1.28 settings.php --- sites/default/settings.php 7 May 2006 00:08:36 -0000 1.28 +++ sites/default/settings.php 1 Jun 2006 06:10:46 -0000 @@ -84,7 +84,7 @@ * $db_url = 'mysqli://username:password@localhost/databasename'; * $db_url = 'pgsql://username:password@localhost/databasename'; */ -$db_url = 'mysql://username:password@localhost/databasename'; +$db_url = 'mysql://drupalcvs:drupalcvs@localhost/drupalcvs'; $db_prefix = ''; /** @@ -106,7 +106,9 @@ * It is not allowed to have a trailing slash; Drupal will add it * for you. */ -# $base_url = 'http://www.example.com'; // NO trailing slash! + +$base_url = 'http://rigel/~lgarfiel/eclipse/drupal'; +#$base_url = 'http://home.garfieldtech.com:8080/~lgarfiel/eclipse/drupal'; /** * PHP settings: