? .svn ? find_path_coder.patch Index: find_path.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/find_path/find_path.module,v retrieving revision 1.1.2.3 diff -u -u -p -r1.1.2.3 find_path.module --- find_path.module 10 Apr 2007 00:11:14 -0000 1.1.2.3 +++ find_path.module 11 Apr 2007 20:39:51 -0000 @@ -1,4 +1,5 @@ 'admin/build/path/find', 'title' => t('Find alias'), 'callback' => 'drupal_get_form', - 'callback arguments' => array('find_path_page'), + 'callback arguments' => array('find_path_page'), 'access' => user_access('administer url aliases'), 'type' => MENU_LOCAL_TASK, ); @@ -34,7 +35,7 @@ function find_path_page() { $form['path'] = array( '#type' => 'textfield', '#title' => t('Aliased path'), - '#default_value' => variable_get( 'find_path_default_path', NULL ), + '#default_value' => variable_get('find_path_default_path', NULL), '#size' => 60, ); $form['submit'] = array( @@ -44,55 +45,54 @@ function find_path_page() { return $form; } -function find_path_page_submit( $form_id, $form_values ) { +function find_path_page_submit($form_id, $form_values) { $path = $form_values['path']; $admin_path = 'admin/build'; - $found = false; + $found = false; - drupal_set_message( "Looking for alias: $path" ); - variable_set( 'find_path_default_path', $path ); - $url = db_fetch_array( db_query( "SELECT src, pid FROM {url_alias} WHERE dst='%s'", $path ) ); - if( $url['pid'] ) { - drupal_set_message( "Found " . $url['src'] .": ". - l( 'View node', $url['src']) ." : ". - l( 'Edit Node', $url['src'].'/edit' ) .' : '. - l( 'Edit Alias', "$admin_path/path/edit/". $url['pid'] ) .' : '. - l( 'Delete Alias', "$admin_path/path/delete/". $url['pid'] ) + drupal_set_message("Looking for alias: $path"); + variable_set('find_path_default_path', $path); + $url = db_fetch_array(db_query("SELECT src, pid FROM {url_alias} WHERE dst='%s'", $path)); + if ($url['pid']) { + drupal_set_message('Found '. $url['src'] .': '. + l('View node', $url['src']) .' : '. + l('Edit Node', $url['src'] .'/edit') .' : '. + l('Edit Alias', "$admin_path/path/edit/". $url['pid']) .' : '. + l('Delete Alias', "$admin_path/path/delete/". $url['pid']) ); // see if there are other aliases for this node - $result = db_query( "SELECT dst, pid FROM {url_alias} WHERE src='%s' AND dst<>'%s'", $url['src'], $path ); - while( $row = db_fetch_array( $result ) ) { - drupal_set_message( "Other alias pointing to same node: " . $row['dst'] . " : " . - l( 'Edit Alias', "$admin_path/path/edit/". $row['pid'] ) .' : '. - l( 'Delete Alias', "$admin_path/path/delete/". $row['pid'] ) - ); + $result = db_query("SELECT dst, pid FROM {url_alias} WHERE src='%s' AND dst<>'%s'", $url['src'], $path); + while ($row = db_fetch_array($result)) { + drupal_set_message('Other alias pointing to same node: '. $row['dst'] .' : '. + l('Edit Alias', "$admin_path/path/edit/". $row['pid']) .' : '. + l('Delete Alias', "$admin_path/path/delete/". $row['pid']) + ); } } else { // #2: look for aliases managed by panels - if( module_exists( 'panels' ) ) { - $panel = db_fetch_array( ( db_query( "SELECT did, title FROM {panels_info} WHERE path='%s'", $path ) ) ); - if( $panel['did'] ) { - $found = true; - drupal_set_message( "Found panel '" . $panel['title'] ."': " . - l( 'Edit Panel', "$admin_path/panels/edit/". $panel['did'] ) - ); - } + if (module_exists('panels')) { + $panel = db_fetch_array((db_query("SELECT did, title FROM {panels_info} WHERE path='%s'", $path))); + if ($panel['did']) { + $found = true; + drupal_set_message("Found panel '". $panel['title'] ."': ". + l('Edit Panel', "$admin_path/panels/edit/". $panel['did']) + ); + } } // #3: look for aliases managed by views - if( module_exists( 'views' ) ) { - $view = db_fetch_array( ( db_query( "SELECT vid, name FROM {view_view} WHERE url='%s'", $path ) ) ); - if( $view['vid'] ) { - $found = true; - drupal_set_message( "Found view '" . $view['name'] ."': " . - l( 'Edit View', "$admin_path/views/edit/". $view['vid'] ) - ); - } + if (module_exists('views')) { + $view = db_fetch_array((db_query("SELECT vid, name FROM {view_view} WHERE url='%s'", $path))); + if ($view['vid']) { + $found = true; + drupal_set_message("Found view '". $view['name'] ."': ". + l('Edit View', "$admin_path/views/edit/". $view['vid']) + ); + } } } - if( !$found ) { - drupal_set_message( "Not found" ); + if (!$found) { + drupal_set_message('Not found'); } - }