Commit c1aadd2a authored by Dries's avatar Dries

- Patch #440920 by brianV: whitespace and coding style clean-up.

parent 097f4937
......@@ -15,14 +15,14 @@ function path_admin_overview($keys = NULL) {
// Add the filter form above the overview table.
$output = drupal_get_form('path_admin_filter_form', $keys);
// Enable language column if locale is enabled or if we have any alias with language
$count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''"));
$count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language <> ''"));
$multilanguage = (module_exists('locale') || $count);
if ($keys) {
// Replace wildcards with PDO wildcards.
$keys = preg_replace('!\*+!', '%', $keys);
$sql = "SELECT * FROM {url_alias} WHERE dst LIKE :keys";
$args = array(':keys' => '%'. $keys .'%');
$args = array(':keys' => '%' . $keys . '%');
}
else {
$sql = 'SELECT * FROM {url_alias}';
......@@ -144,7 +144,7 @@ function path_admin_form_validate($form, &$form_state) {
// Language is only set if locale module is enabled, otherwise save for all languages.
$language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) {
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid <> %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) {
form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst)));
}
$item = menu_get_item($src);
......
......@@ -18,8 +18,8 @@ function path_help($path, $arg) {
$output .= '<li>' . t('%alias for the path %path', array('%alias' => 'store', '%path' => 'image/tid/16')) . '</li>';
$output .= '<li>' . t('%alias for the path %path', array('%alias' => 'store/products/whirlygigs', '%path' => 'taxonomy/term/7+19+20+21')) . '</li>';
$output .= '<li>' . t('%alias for the path %path', array('%alias' => 'contact', '%path' => 'node/3')) . '</li></ul>';
$output .= '<p>' . t('The path module enables appropriately permissioned users to specify an optional alias in all node input and editing forms, and provides an interface to view and edit all URL aliases. The two permissions related to URL aliasing are <em>administer url aliases</em> and <em>create url aliases</em>. ') . '</p>';
$output .= '<p>' . t('This module also provides user-defined mass URL aliasing capabilities, which is useful if you wish to uniformly use URLs different from the default. For example, you may want to have your URLs presented in a different language. Access to the Drupal source code on the web server is required to set up mass URL aliasing. ') . '</p>';
$output .= '<p>' . t('The path module enables appropriately permissioned users to specify an optional alias in all node input and editing forms, and provides an interface to view and edit all URL aliases. The two permissions related to URL aliasing are <em>administer url aliases</em> and <em>create url aliases</em>.') . ' </p>';
$output .= '<p>' . t('This module also provides user-defined mass URL aliasing capabilities, which is useful if you wish to uniformly use URLs different from the default. For example, you may want to have your URLs presented in a different language. Access to the Drupal source code on the web server is required to set up mass URL aliasing.') . ' </p>';
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@path">Path module</a>.', array('@path' => 'http://drupal.org/handbook/modules/path/')) . '</p>';
return $output;
case 'admin/build/path':
......@@ -125,7 +125,7 @@ function path_node_validate($node, $form) {
if (isset($node->path)) {
$language = isset($node->language) ? $node->language : '';
$node->path = trim($node->path);
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) {
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src <> '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) {
form_set_error('path', t('The path is already in use.'));
}
}
......
<?php
// $Id$
/**
* @file
* Tests for the path module
*/
class PathTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment