diff -urN modulesold\devel\devel.module modules\devel\devel.module
--- modulesold\devel\devel.module Mon Sep 05 10:00:10 2005
+++ modules\devel\devel.module Sun Sep 11 11:08:48 2005
@@ -21,6 +21,19 @@
}
/**
+ * Implementation of timer_read for versions not having it.
+ * @return float Time elapsed
+ */
+if (!function_exists('timer_read'))
+ {
+ function timer_read() {
+ global $timer;
+ list($usec, $sec) = explode(' ', microtime());
+ return (float)$usec + (float)$sec - $timer ;
+ }
+ }
+
+/**
* Implementation of hook_menu().
*/
function devel_menu($may_cache) {
@@ -78,16 +91,17 @@
}
}
- if (function_exists('drupal_get_headers') && strstr(drupal_get_headers(), 'xml')) {
- $is_xml = TRUE;
- };
- if (user_access('access devel information') && !$is_xml) { // try not to break the xml pages
+ $is_xml = function_exists('drupal_get_headers') && strstr(drupal_get_headers(), 'xml') ;
+
+ if (user_access('access devel information') && !$is_xml) { // try not to break the xml pages
// Query log off, timer on
if (!variable_get('dev_query', 0) && variable_get('dev_timer', 0)) {
$output = '
'. devel_timer() .'
';
}
// Query log on
+ $sum = 0 ;
+ if (!isset ($output)) $output = '' ;
if (variable_get('dev_query', 0)) {
foreach ($queries as $query) {
$text[] = $query[0];
@@ -153,7 +167,7 @@
$i++;
unset($diff, $count);
}
- return theme('table', $header, $cell);
+ return theme('table', $header, $cell, array('id' => 'develTableQuery')); //XXXwas without attributes
}
/**
diff -urN modulesold\filter.module modules\filter.module
--- modulesold\filter.module Fri Sep 09 21:35:14 2005
+++ modules\filter.module Fri Sep 09 21:39:39 2005
@@ -626,7 +626,7 @@
function filter_list_format($format) {
static $filters = array();
- if (!is_array($filters[$format]))
+ if ((!isset ($filters[$format])) || (!is_array($filters[$format])))
{
$filters[$format] = array();
$result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC", $format);
diff -urN modulesold\node.module modules\node.module
--- modulesold\node.module Fri Sep 09 21:36:39 2005
+++ modules\node.module Sun Sep 11 14:22:39 2005
@@ -120,7 +120,7 @@
$history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = '$user->uid' AND nid = %d", $nid));
}
- return ($history[$nid]->timestamp ? $history[$nid]->timestamp : 0);
+ return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0); //XXXwas return ($history[$nid]->timestamp ? $history[$nid]->timestamp : 0);
}
/**
@@ -402,7 +402,7 @@
$fields = node_invoke_nodeapi($node, 'fields');
// Serialize the revisions field:
- if ($node->revisions) {
+ if (isset ($node->revisions) ? $node->revisions : FALSE) { //XXXwas if ($node->revisions) {
$node->revisions = serialize($node->revisions);
}
@@ -414,7 +414,7 @@
if (!$node->created) {
$node->created = time();
}
- if (!$node->changed) {
+ if ((!isset ($node->changed)) || (!$node->changed)) { //XXXwas if (!$node->changed) {
$node->changed = time();
}
$node->nid = db_next_id('{node}_nid');
@@ -516,7 +516,7 @@
function node_prepare($node, $teaser = FALSE) {
$node->readmore = (strlen($node->teaser) < strlen($node->body));
if ($teaser == FALSE) {
- $node->body = check_output($node->body, $node->format);
+ $node->body = isset ($node->format) ? check_output($node->body, $node->format) : '' ; //XXXwas $node->body = check_output($node->body, $node->format);
}
else {
$node->teaser = check_output($node->teaser, $node->format);
@@ -720,13 +720,15 @@
function node_last_changed($nid) {
$node = db_fetch_object(db_query('SELECT changed FROM {node} WHERE nid = %d', $nid));
- return ($node->changed);
+ return (isset($node->changed) ? $node->changed : NULL); //XXXwas return ($node->changed);
}
/**
* Generate the content administration overview.
*/
function node_admin_nodes() {
+ $b = ''; //XXXwas not initialized
+ $output = ''; //XXXwas not initialized
/*
** Operations
*/
@@ -740,9 +742,9 @@
);
// Handle operations
- $op = $_POST['op'];
-
- $edit = $_POST['edit'];
+ $op = isset($_POST['op']) ? $_POST['op'] : ''; //XXXwas $op = $_POST['op'];
+ $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; //XXXwas $edit = $_POST['edit'];
+
if (($op == t('Update') || $op == t('Delete all')) && isset($edit['operation']) && isset($edit['nodes'])) {
$edit['nodes'] = array_diff($edit['nodes'], array(0));
if (count($edit['nodes']) == 0) {
@@ -822,7 +824,8 @@
$_SESSION['node_overview_filter'] = array();
}
$session = &$_SESSION['node_overview_filter'];
- $filter = $edit['filter'];
+
+ $filter = (is_array($edit) && isset($edit['filter'])) ? $edit['filter'] : ''; //XXXwas $filter = $edit['filter'];
if (($op == t('Filter') || $op == t('Refine')) && isset($filter)) {
if (isset($filters[$filter]['options'][$edit[$filter]])) {
$session[] = array($filter, $edit[$filter]);
@@ -1010,7 +1013,7 @@
// "Revision" is the name of the field used to indicate that we have to
// create a new revision of a node.
- if ($node->nid && $node->revision) {
+ if (isset ($node->nid) && $node->nid && $node->revision) { //XXXwas if ($node->nid && $node->revision) {
$prev = node_load(array('nid' => $node->nid));
$node->revisions = $prev->revisions;
unset($prev->revisions);
@@ -1085,8 +1088,8 @@
* Menu callback; presents the content administration overview.
*/
function node_admin() {
- $op = $_POST['op'];
- $edit = $_POST['edit'];
+ $op = isset($_POST['op']) ? $_POST['op'] : ''; //XXXwas $op = $_POST['op'];
+ $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; //XXXwas $op = $_POST['edit'];
if (empty($op)) {
$op = arg(2);
@@ -1202,20 +1205,23 @@
// Auto-generate the teaser, but only if it hasn't been set (e.g. by a
// module-provided 'teaser' form item).
if (!isset($node->teaser)) {
- $node->teaser = node_teaser($node->body, $node->format);
+ $node->teaser = node_teaser(
+ isset($node->body) ? $node->body : '',
+ isset($node->format) ? $node->format : ''); //XXXwas $node->teaser = node_teaser($node->body, $node->format);
}
- if (node_last_changed($node->nid) > $node->changed) {
+ if (node_last_changed(
+ (isset ($node->nid) ? $node->nid : 0)) > (isset ($node->changed) ? $node->changed : 0)) { //XXXwas if (node_last_changed($node->nid) > $node->changed) {
form_set_error('changed', t('This content has been modified by another user, unable to save changes.'));
}
if (user_access('administer nodes')) {
// Set up default values, if required.
- if (!$node->created) {
+ if ((!isset ($node->created)) || !$node->created) { //XXXwas if (!$node->created) {
$node->created = time();
}
- if (!$node->date) {
+ if ((!isset ($node->date)) || !$node->date) {
$node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
}
@@ -1275,8 +1281,12 @@
* Generate the node editing form.
*/
function node_form($edit) {
+ $output = '' ; //XXXwas not initialized
+ $options = '' ; //XXXwas not initialized
+ $extras = '' ; //XXXwas not initialized
+ $op = isset($_POST['op']) ? $_POST['op'] : '' ; //XXXwas not defined: raw access to $POST['op')
// Validate the node if we don't already know the errors.
- if (!$edit->validated) {
+ if ((!isset($edit)) || (!isset ($edit->validated)) || !$edit->validated) { //XXXwas if (!$edit->validated) {
$edit = node_validate($edit);
}
@@ -1327,13 +1337,13 @@
// Add the default fields.
$output .= '';
- $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE);
+ $output .= form_textfield(t('Title'), 'title', isset($edit->title) ? $edit->title : '', 60, 128, NULL, NULL, TRUE); //XXXwas $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE);
// Add the node-type-specific fields.
$output .= $form;
// Add the hidden fields.
- if ($edit->nid) {
+ if (isset ($edit->nid) && $edit->nid) { //XXXwas if ($edit->nid) {
$output .= form_hidden('nid', $edit->nid);
}
@@ -1347,7 +1357,7 @@
$output .= form_hidden('created', $edit->created);
}
- if ($edit->changed) {
+ if (isset ($edit->changed) && $edit->changed) {
$output .= form_hidden('changed', $edit->changed);
}
@@ -1356,11 +1366,11 @@
// Add the buttons.
$output .= form_submit(t('Preview'));
- if ($edit->type && (($_POST['op'] == t('Preview') && !form_get_errors()) || !variable_get('node_preview', 0))) {
+ if ($edit->type && (($op == t('Preview') && !form_get_errors()) || !variable_get('node_preview', 0))) {
$output .= form_submit(t('Submit'));
}
- if ($edit->nid && node_access('delete', $edit)) {
+ if (isset ($edit->nid) && $edit->nid && node_access('delete', $edit)) {
$output .= form_submit(t('Delete'));
}
@@ -1382,10 +1392,13 @@
}
$attributes = array('id' => 'node-form');
- if (is_array($param['options'])) {
+ if (isset($param['option']) && is_array($param['options'])) { //XXXwas if (is_array($param['options'])) {
$attributes = array_merge($param['options'], $attributes);
}
- return form($output, ($param['method'] ? $param['method'] : 'post'), $param['action'], $attributes);
+ return form($output, //XXXwas not tested for isset
+ ((isset($param['method']) && $param['method']) ? $param['method'] : 'post'),
+ (isset($param['action']) ? $param['action'] : ''),
+ $attributes);
}
/**
@@ -1394,17 +1407,23 @@
function node_add($type) {
global $user;
- $edit = $_POST['edit'];
+ $edit = isset ($_POST['edit']) ? $_POST['edit'] : '' ; //XXX was $edit = $_POST['edit'];
// If a node type has been specified, validate its existence.
if (in_array($type, node_list()) && node_access('create', $type)) {
// Initialize settings:
+ /* --- Just doing this doesn't work: ----
+ $node = new stdClass() ;
+ $node->uid = $user->uid ;
+ $node->name = $user->name ;
+ $node->type = isset ($user->type) ? $user->type : NULL ;
+ -- There's more to it, so we keep the array for now --- */
$node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type);
// Allow the following fields to be initialized via $_GET (e.g. for use
// with a "blog it" bookmarklet):
foreach (array('title', 'teaser', 'body') as $field) {
- if ($_GET['edit'][$field]) {
+ if (isset ($_GET['edit']) && isset($_GET['edit'][$field]) && $_GET['edit'][$field]) { //XXXwas if ($_GET['edit'][$field]) {
$node[$field] = $_GET['edit'][$field];
}
}
@@ -1454,6 +1473,7 @@
* Generate a node preview, including a form for further edits.
*/
function node_preview($node) {
+ $output = '' ; //XXXwas not initialized
// Convert the array to an object:
$node = array2object($node);
@@ -1545,7 +1565,7 @@
}
// Prepare the node's body:
- if ($node->nid) {
+ if (isset ($node->nid) ? $node->nid : 0) { //XXXwas if ($node->nid) {
// Check whether the current user has the proper access rights to
// perform this operation:
if (node_access('update', $node)) {
@@ -1644,8 +1664,8 @@
* Menu callback; dispatches control to the appropriate operation handler.
*/
function node_page() {
- $op = $_POST['op'] ? $_POST['op'] : arg(1);
- $edit = $_POST['edit'];
+ $op = isset($_POST['op']) ? $_POST['op'] : arg(1);
+ $edit = isset($_POST['edit']) ? $_POST['edit'] : '' ;
if (is_numeric($op)) {
$op = (arg(2) && !is_numeric(arg(2))) ? arg(2) : 'view';
@@ -1964,7 +1984,7 @@
}
}
$sql .= implode(',', $grants) .') AND grant_view = 1';
- $result = db_query($sql, $node->nid);
+ $result = db_query($sql);
$access = db_result($result);
}
diff -urN modulesold\path.module modules\path.module
--- modulesold\path.module Sun Jun 19 21:28:08 2005
+++ modules\path.module Sat Sep 10 22:56:35 2005
@@ -198,11 +198,15 @@
if (user_access('create url aliases') || user_access('administer url aliases')) {
switch ($op) {
case 'validate':
- $node->path = trim($node->path);
+ $node->path = isset ($node->path) ? trim($node->path) : '' ; //XXXwas $node->path = trim($node->path);
if ($node->path && !valid_url($node->path)) {
form_set_error('path', t('The path is invalid.'));
}
- else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
+ else if (db_result(
+ db_query(
+ "SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'",
+ $node->path,
+ "node/" . (isset ($node->nid) ? $node->nid : '')))) { //XXXwas else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
form_set_error('path', t('The path is already in use.'));
}
break;
diff -urN modulesold\system.module modules\system.module
--- modulesold\system.module Sun Sep 04 23:53:22 2005
+++ modules\system.module Sun Sep 11 10:51:48 2005
@@ -299,7 +299,7 @@
while ($file = db_fetch_object($result)) {
if (is_object($files[$file->name])) {
foreach ($file as $key => $value) {
- if (!$files[$file->name]->$key) {
+ if ((!isset ($files[$file->name]->$key)) || (!$files[$file->name]->$key)) { //XXXwas if (!$files[$file->name]->$key) {
$files[$file->name]->$key = $value;
}
}
@@ -504,8 +504,8 @@
}
function system_listing_save($edit = array()) {
- $op = $_POST['op'];
- $edit = $_POST['edit'];
+ $op = isset($_POST['op']) ? $_POST['op' ] : ''; //XXXwas $op = $_POST['op'];
+ $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; //XXXwas $edit = $_POST['edit'];
if ($op == t('Save configuration')) {
db_query("UPDATE {system} SET status = 0 WHERE type = '%s'", $edit['type']);
diff -urN modulesold\taxonomy.module modules\taxonomy.module
--- modulesold\taxonomy.module Tue Jul 19 23:31:03 2005
+++ modules\taxonomy.module Sun Sep 11 14:09:06 2005
@@ -35,7 +35,7 @@
}
else {
$links = array();
- foreach (taxonomy_node_get_terms($node->nid) as $term) {
+ foreach (taxonomy_node_get_terms(isset($node->nid) ? $node->nid : 0) as $term) { //XXXwas foreach (taxonomy_node_get_terms($node->nid) as $term)
$links[] = l($term->name, 'taxonomy/term/'. $term->tid);
}
@@ -630,7 +630,7 @@
$terms[$vid][$child]->parents = $parents[$vid][$child];
$tree[] = $terms[$vid][$child];
- if ($children[$vid][$child]) {
+ if (isset($children[$vid][$child])) { //XXXwas if (iset($children[$vid][$child])) {
$tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
}
}
@@ -772,6 +772,7 @@
}
function _taxonomy_depth($depth, $graphic = '--') {
+ $result = '' ; //XXXwas not initialized
for ($n = 0; $n < $depth; $n++) {
$result .= $graphic;
}
@@ -885,7 +886,8 @@
function taxonomy_nodeapi($node, $op, $arg = 0) {
switch ($op) {
case 'insert':
- taxonomy_node_save($node->nid, $node->taxonomy);
+ if (isset ($node->taxonomy)) //XXXwas not tested
+ taxonomy_node_save($node->nid, $node->taxonomy);
break;
case 'update':
taxonomy_node_save($node->nid, $node->taxonomy);
diff -urN modulesold\user.module modules\user.module
--- modulesold\user.module Fri Sep 09 21:37:32 2005
+++ modules\user.module Fri Sep 09 21:40:18 2005
@@ -327,6 +327,7 @@
// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
if (!isset($perm[$account->uid])) {
+ $perm[$account->uid] = '' ;
$result = db_query('SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $account->uid);
while ($row = db_fetch_object($result)) {
@@ -1215,8 +1216,8 @@
function user_page() {
global $user;
- $edit = $_POST['edit'];
- $op = $_POST['op'];
+ $edit = isset ($_POST['edit']) ? $_POST['edit'] : '' ;
+ $op = isset ($_POST['op']) ? $_POST['op'] : '' ;
if (empty($op)) {
$op = arg(2) ? arg(2) : arg(1);
diff -urN modulesold\watchdog.module modules\watchdog.module
--- modulesold\watchdog.module Fri Sep 09 21:37:54 2005
+++ modules\watchdog.module Fri Sep 09 21:40:26 2005
@@ -77,7 +77,7 @@
$_SESSION['watchdog_overview_filter'] = 'all';
}
- $op = $_POST['op'];
+ $op = isset($_POST['op']) ? $_POST['op'] : '' ;
if ($op == t('Filter') && isset($_POST['edit']['filter'])) {
$_SESSION['watchdog_overview_filter'] = $_POST['edit']['filter'];
}