Skip to content
Commits on Source (41)
Drupal 4.4.2, 2004-07-04
------------------------
- fixed bugs: no critical bugs were identified.
Drupal 4.4.1, 2004-05-01
------------------------
- fixed bugs: no critical bugs were identified.
Drupal 4.4.0, 2004-04-01
------------------------
......
......@@ -333,27 +333,25 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
fwrite($fp, $request);
// Fetch response.
while (!feof($fp) && $data = fgets($fp, 1024)) {
$response[] = $data;
$response = '';
while (!feof($fp) && $data = fread($fp, 1024)) {
$response .= $data;
}
fclose($fp);
// Parse response.
list($protocol, $code, $text) = explode(' ', trim(array_shift($response)), 3);
list($headers, $result->data) = explode("\r\n\r\n", $response, 2);
$headers = preg_split("/\r\n|\n|\r/", $headers);
list($protocol, $code, $text) = explode(' ', trim(array_shift($headers)), 3);
$result->headers = array();
$result->data = '';
// Parse headers.
while ($line = trim(array_shift($response))) {
if ($line == '') {
break;
}
while ($line = trim(array_shift($headers))) {
list($header, $value) = explode(':', $line, 2);
$result->headers[$header] = trim($value);
}
$result->data = implode('', $response);
$responses = array(
100 => 'Continue', 101 => 'Switching Protocols',
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content',
......@@ -549,7 +547,7 @@ function drupal_specialchars($input, $quotes = ENT_NOQUOTES) {
*/
function valid_email_address($mail) {
$user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';
$domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+';
$domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+';
$ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
$ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';
......@@ -903,7 +901,7 @@ function format_name($object) {
*/
if (strlen($object->name) > 20) {
$name = substr($object->name, 0, 15) ."...";
$name = truncate_utf8($object->name, 15) ."...";
}
else {
$name = $object->name;
......@@ -1100,7 +1098,7 @@ function drupal_attributes($attributes = array()) {
}
function l($text, $url, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = NULL) {
if ($url == $_GET['q']) {
if (drupal_get_normal_path($url) == $_GET['q']) {
if (isset($attributes['class'])) {
$attributes['class'] .= ' active';
}
......@@ -1219,6 +1217,31 @@ function drupal_xml_parser_create(&$data) {
return $xml_parser;
}
/**
* UTF-8-safe string truncation
* If the end position is in the middle of a UTF-8 sequence, it scans backwards
* until the beginning of the byte sequence.
*
* Use this function whenever you want to chop off a string at an unsure
* location. On the other hand, if you're sure that you're splitting on a
* character boundary (e.g. after using strpos or similar), you can safely use
* substr() instead.
*
* @param $string The string to truncate
* @param $len An upper limit on the returned string length.
*/
function truncate_utf8($string, $len) {
$slen = strlen($string);
if ($slen <= $len) {
return $string;
}
if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
return substr($string, 0, $len);
}
while (ord($string[--$len]) < 0xC0) {};
return substr($string, 0, $len);
}
include_once "includes/theme.inc";
include_once "includes/pager.inc";
include_once "includes/menu.inc";
......@@ -1230,7 +1253,7 @@ function drupal_xml_parser_create(&$data) {
set_error_handler("error_handler");
// spit out the correct charset http header
header("Content-Type: text/html; charset=utf-8");
drupal_set_header("Content-Type: text/html; charset=utf-8");
// initialize the _GET["q"] prior to loading the modules and invoking their 'init' hook:
if (!empty($_GET["q"])) {
......
......@@ -170,7 +170,7 @@ function pager_next($text, $limit, $element = 0, $n = 1, $attributes = array())
function pager_last($text, $limit, $element = 0, $attributes = array()) {
global $pager_from_array, $pager_total;
$from_new = pager_load_array(($pager_total[$element] - $limit), $element, $pager_from_array);
$from_new = pager_load_array(($pager_total[$element] - ($pager_total[$element] % $limit)), $element, $pager_from_array);
if ($from_new[$element] < ($pager_from_array[$element] + $limit)) {
return pager_next($text, $limit, $element, 1, $attributes);
}
......
......@@ -95,7 +95,7 @@ function tablesort_get_sort($headers) {
// user has not specified a sort. check module for default and if none, use 'asc'
else {
foreach ($headers as $header) {
if (isset($header['sort'])) {
if (is_array($header) && isset($header['sort'])) {
return $header['sort'];
}
}
......
......@@ -361,7 +361,7 @@ function theme_table($header, $rows, $attributes = NULL) {
* @return a string containing the @a box output.
*/
function theme_box($title, $content, $region = 'main') {
$output = "<h2 class=\"title\">$title</h2><p>$content</p>";
$output = "<h2 class=\"title\">$title</h2><div>$content</div>";
return $output;
}
......
......@@ -215,6 +215,7 @@ function aggregator_get_feeds($attributes = 0) {
function aggregator_remove($feed) {
db_query("DELETE FROM {item} WHERE fid = %d", $feed["fid"]);
db_query("UPDATE {feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']);
drupal_set_message(t("removed news items from '%site'.", array("%site" => $feed["title"])));
}
......@@ -368,7 +369,7 @@ function aggregator_parse_feed(&$data, $feed) {
xml_parser_free($xml_parser);
// initialize the translation table:
$tt = array_flip(get_html_translation_table(HTML_ENTITIES));
$tt = array_flip(get_html_translation_table(HTML_SPECIALCHARS));
$tt["&apos;"] = "'";
/*
......@@ -397,7 +398,7 @@ function aggregator_parse_feed(&$data, $feed) {
$title = $item["TITLE"];
}
else {
$title = preg_replace('/^(.*)[^\w;&].*?$/', "\\1", substr($item["DESCRIPTION"], 0, 40));
$title = preg_replace('/^(.*)[^\w;&].*?$/', "\\1", truncate_utf8($item["DESCRIPTION"], 40));
}
/*
......@@ -832,7 +833,7 @@ function theme_aggregator_feed($feed) {
function theme_aggregator_block_item($item, $feed = 0) {
global $user;
if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) {
if ($user->uid && module_exist("blog") && user_access("edit own blog")) {
$output .= "<div class=\"icon\">". l("<img src=\"". theme("image", "blog.gif") ."\" alt=\"". t("blog it") ."\" title=\"". t("blog it") ."\" />", "node/add/blog", array("title" => t("Comment on this news item in your personal blog."), "class" => "blog-it"), "iid=$item->iid") ."</div>";
}
......
......@@ -19,7 +19,7 @@ function block_help($section = "admin/help#block") {
<h4>PHP in admin-defined blocks</h4>
<p>If you know how to script in PHP, Drupal gives you the power to embed any script you like inside a block. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you don't write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP blocks because you can corrupt your database or render your site insecure or even unusable! If you don't plan to do fancy stuff with your blocks then you're probably better off with straight HTML.</p>
<p>Remember that the code within each PHP block must be valid PHP code - including things like correctly terminating statements with a semicolon so that the parser won't die. It is highly recommended that you develop your blocks separately using a simple test script on top of a test database before migrating to your production environment.</p>
<p>Notes:</p><ul><li>You can use global variables, such as configuration parameters, within the scope of a PHP box but remember that variables which have been given values in a PHP box will retain these values in the engine or module afterwards.</li><li>register_globals is now set to <strong>off</strong> by default. If you need form information you need to get it from the \"superglobals\" \$_POST, \$_GET, etc.</li><li>You shuold use the <code>return</code> statement to return the actual content for your block.</li></ul>
<p>Notes:</p><ul><li>You can use global variables, such as configuration parameters, within the scope of a PHP box but remember that variables which have been given values in a PHP box will retain these values in the engine or module afterwards.</li><li>register_globals is now set to <strong>off</strong> by default. If you need form information you need to get it from the \"superglobals\" \$_POST, \$_GET, etc.</li><li>You should use the <code>return</code> statement to return the actual content for your block.</li></ul>
<p>A basic example:</p>
<blockquote><p>You want to have a box with the title \"Welcome\" that you use to greet your visitors. The content for this box could be created by going:</p>
<pre>
......
......@@ -86,7 +86,7 @@ function blog_feed_user($uid = 0) {
$result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15);
$channel["title"] = $account->name ."'s blog";
$channel["link"] = url("blog/view/$uid", NULL, NULL, TRUE);
$channel["link"] = url("blog/$uid", NULL, NULL, TRUE);
$channel["description"] = $term->description;
node_feed($result, $channel);
}
......
......@@ -43,7 +43,7 @@ function blogapi_get_users_blogs($req_params) {
$user = blogapi_validate_user($params[1], $params[2]);
if ($user->uid) {
$struct = new xmlrpcval(array('url' => new xmlrpcval(url('blog/' . $user->uid)),
$struct = new xmlrpcval(array('url' => new xmlrpcval(url('blog/' . $user->uid, NULL, NULL, true)),
'blogid' => new xmlrpcval($user->uid),
'blogName' => new xmlrpcval($user->name . "'s blog")),
'struct');
......@@ -67,7 +67,7 @@ function blogapi_get_user_info($req_params) {
'firstname' => new xmlrpcval($name[0], 'string'),
'nickname' => new xmlrpcval($user->name, 'string'),
'email' => new xmlrpcval($user->mail, 'string'),
'url' => new xmlrpcval(url('blog/view/' . $user->uid), 'string')),
'url' => new xmlrpcval(url('blog/view/' . $user->uid, NULL, NULL, true), 'string')),
'struct');
return new xmlrpcresp($struct);
}
......@@ -230,8 +230,8 @@ function blogapi_new_media_object($req_params) {
function blogapi_get_category_list($req_params) {
$vocabularies = module_invoke('taxonomy', 'get_vocabularies', 'blog', 'vid');
$categories = array();
if ($vocabularies) {
$categories = array();
foreach ($vocabularies as $vocabulary) {
$terms = module_invoke('taxonomy', 'get_tree', $vocabulary->vid, 0, -1, 'tid');
foreach ($terms as $term) {
......@@ -244,11 +244,8 @@ function blogapi_get_category_list($req_params) {
'struct');
}
}
return new xmlrpcresp(new xmlrpcval($categories, "array"));
}
else {
return blogapi_error('no categories');
}
return new xmlrpcresp(new xmlrpcval($categories, "array"));
}
function blogapi_get_post_categories($req_params) {
......
......@@ -283,7 +283,7 @@ function comment_post($edit) {
$edit["subject"] = strip_tags($edit["subject"]);
if ($edit["subject"] == "") {
$edit["subject"] = substr(strip_tags($edit["comment"]), 0, 29);
$edit["subject"] = truncate_utf8(strip_tags($edit["comment"]), 29);
}
/*
......@@ -537,7 +537,6 @@ function comment_render($node, $cid = 0) {
if (empty($order)) {
$order = $user->sort ? $user->sort : ($_SESSION["comment_sort"] ? $_SESSION["comment_sort"] : variable_get("comment_default_order", 1));
}
if (empty($threshold)) {
$threshold = $user->threshold ? $user->threshold : ($_SESSION["comment_threshold"] ? $_SESSION["comment_threshold"] : variable_get("comment_default_threshold", 0));
}
......@@ -1002,10 +1001,10 @@ function comment_mod_matrix($edit) {
db_query("DELETE FROM {moderation_roles} ");
foreach ($edit as $role_id => $votes) {
foreach ($votes as $mid => $value) {
$sql[] = "('$mid', '$role_id', '". ($value ? $value : 0) ."')";
$sql = "('$mid', '$role_id', '". ($value ? $value : 0) ."')";
db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". $sql);
}
}
db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". implode(", ", $sql));
drupal_set_message(t("the vote values have been saved."));
}
......@@ -1326,6 +1325,9 @@ function theme_comment_threshold($threshold) {
if ($filters) {
return "<select name=\"threshold\">$filters</select>\n";
}
else {
return "<input type=\"hidden\" name=\"threshold\" value=\"$threshold\" />\n";
}
}
function theme_comment_controls($threshold = 1, $mode = 3, $order = 1, $comments_per_page = 50) {
......@@ -1391,7 +1393,7 @@ function theme_comment($comment, $links = 0) {
$output .= "<div class=\"subject\">$comment->subject". ($comment->new ? ' '. theme('mark') : '') ."</div>\n";
$output .= "<div class=\"moderation\">". $comment->moderation ."</div>\n";
$output .= "<div class=\"credit\">". t("by %a on %b", array("%a" => format_name($comment), "%b" => format_date($comment->timestamp))) ."</div>\n";
$output .= "<div class=\"body\">". check_output($comment->comment) ."</div>\n";
$output .= "<div class=\"body\">$comment->comment</div>\n";
$output .= "<div class=\"links\">$links</div>\n";
$output .= "</div>\n";
return $output;
......@@ -1649,9 +1651,7 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
case "form admin":
if (user_access("administer comments")) {
$selected = isset($node->comment) ? $node->comment : variable_get("comment_$node->type", 2);
$output = form_radio(t("Disabled"), "comment", 0, ($selected == 0));
$output .= form_radio(t("Read only"), "comment", 1, ($selected == 1));
$output .= form_radio(t("Read/write"), "comment", 2, ($selected == 2));
$output = form_radios("", "comment", $selected, array(t("Disabled"), t("Read only"), t("Read/write")));
return form_group(t("User comments"), $output);
}
break;
......
......@@ -39,7 +39,7 @@ function drupal_settings() {
$error["drupal_directory"] = theme("error", t("You must set your site's mission at the <a href=\"%url\">site configuration</a>.", array("%url" => url("admin/system"))));
$output = form_textfield(t("Drupal XML-RPC server"), "drupal_server", variable_get("drupal_server", "http://www.drupal.org/xmlrpc.php"), 55, 128, t("The URL of your root Drupal XML-RPC server."));
$output .= form_radios(t("Drupal directory"), "drupal_directory", variable_get("drupal_directory", 0), array(t("Disabled"), t("Enabled")), t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php")) . $error["drupal_directory"]);
$output .= form_radios(t("Drupal directory"), "drupal_directory", variable_get("drupal_directory", 0), array(t("Disabled"), t("Enabled")), t("If enabled, your Drupal site will make itself known to the Drupal directory at the specified Drupal XML-RPC server. For this to work properly, you must set your site's name, e-mail address, slogan and mission statement. When the \"Drupal XML-RPC server\" field is set to \"%drupal-xml-rpc\", your web site will get listed on the <a href=\"%drupal-sites\">Drupal sites</a> page. Requires the cron feature to be enabled.", array("%drupal-xml-rpc" => "http://www.drupal.org/xmlrpc.php", "%drupal-sites" => "http://www.drupal.org/sites/")) . $error["drupal_directory"]);
return $output;
}
......
......@@ -64,7 +64,7 @@ function filter_admin_order() {
filter_refresh();
$filters = filter_list();
$header = array("name", "weight");
$header = array(t('name'), t('weight'));
$rows = array();
// Standard HTML filters are always run first, we add a dummy row to indicate this
......
......@@ -259,7 +259,7 @@ function _forum_last_reply($nid) {
}
function _forum_format($topic) {
if ($topic) {
if ($topic && $topic->timestamp) {
return t('%time ago<br />by %author', array('%time' => format_interval(time() - $topic->timestamp), '%author' => format_name($topic)));
}
else {
......
......@@ -213,7 +213,7 @@ function node_teaser($body) {
** Nevermind, we split it the hard way ...
*/
return substr($body, 0, $size);
return truncate_utf8($body, $size);
}
......@@ -401,7 +401,9 @@ function node_save($node) {
if (!$node->created) {
$node->created = time();
}
$node->changed = time();
if (!$node->changed) {
$node->changed = time();
}
$node->nid = db_next_id('{node}_nid');
// Prepare the query:
......@@ -675,11 +677,13 @@ function node_admin_nodes() {
$_SESSION['node_overview_filter'] = 0;
}
if (isset($_POST['edit']['filter'])) {
$op = $_POST['op'];
if ($op == t('Filter') && isset($_POST['edit']['filter'])) {
$_SESSION['node_overview_filter'] = $_POST['edit']['filter'];
}
if (isset($_POST['edit']['operation'])) {
if ($op == t('Update') && isset($_POST['edit']['operation']) && isset($_POST['edit']['status'])) {
$operation = $operations[$_POST['edit']['operation']][1];
foreach ($_POST['edit']['status'] as $nid => $value) {
if ($value) {
......@@ -702,7 +706,7 @@ function node_admin_nodes() {
}
$form = form_select(NULL, 'filter', $filter, $options);
$form .= form_submit(t('Go'));
$form .= form_submit(t('Filter'));
$output .= '<h3>'. t('Filter options') .'</h3>';
$output .= "<div class=\"container-inline\">$form</div>";
......@@ -711,13 +715,18 @@ function node_admin_nodes() {
** Render operations form:
*/
$result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid '. $filters[$filter][1], 50);
// Make sure the update controls are disabled if we don't have any rows to select from.
$disabled = !db_num_rows($result);
$options = array();
foreach ($operations as $key => $value) {
$options[] = $value[0];
}
$form = form_select(NULL, 'operation', 0, $options);
$form .= form_submit(t('Go'));
$form = form_select(NULL, 'operation', 0, $options, NULL, ($disabled ? 'disabled="disabled"' : ''));
$form .= form_submit(t('Update'), 'op', ($disabled ? array('disabled' => 'disabled') : array()));
$output .= '<h3>'. t('Update options') .'</h3>';
$output .= "<div class=\"container-inline\">$form</div>";
......@@ -726,7 +735,6 @@ function node_admin_nodes() {
** Overview table:
*/
$result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid '. $filters[$filter][1], 50);
$header = array(NULL, t('title'), t('type'), t('author'), t('status'), array('data' => t('operations'), 'colspan' => 2));
while ($node = db_fetch_object($result)) {
......@@ -1487,7 +1495,7 @@ function node_page_default() {
$result = pager_query('SELECT nid, type FROM {node} WHERE promote = 1 AND status = 1 ORDER BY static DESC, created DESC', variable_get('default_nodes_main', 10));
if (db_num_rows($result)) {
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS" href="'. url('node/feed') .'" />');
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS" href="'. url('node/feed', NULL, NULL, TRUE) .'" />');
$output = '';
while ($node = db_fetch_object($result)) {
......
......@@ -131,7 +131,7 @@ function poll_form(&$node, &$error) {
// Poll attributes
$_duration = array_merge(array(0 => t('Unlimited')), drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval"));
$_duration = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");
$_active = array(0 => t('Closed'), 1 => t('Active'));
if ($admin) {
......
......@@ -110,10 +110,10 @@ function queue_overview() {
while ($node = db_fetch_object($sresult)) {
if ($user->uid == $node->uid || field_get($node->users, $user->uid)) {
$rows[] = array(array("data" => l($node->title, "queue/$node->nid"), "class" => "title"), array("data" => format_name($node), "class" => "name"), array("data" => module_invoke($node->type, "node", "name"), "class" => "type"), array("data" => queue_score($node->nid), "class" => "score"));
$rows[] = array(array("data" => l($node->title, "queue/$node->nid"), "class" => "title"), array("data" => format_name($node), "class" => "name"), array("data" => module_invoke($node->type, "node_name", $node), "class" => "type"), array("data" => queue_score($node->nid), "class" => "score"));
}
else {
$rows[] = array(array("data" => l($node->title, "queue/$node->nid"), "class" => "title"), array("data" => format_name($node), "class" => "name"), array("data" => module_invoke($node->type, "node", "name"), "class" => "type"), array("data" => l(t("vote"), "queue/$node->nid"), "class" => "score"));
$rows[] = array(array("data" => l($node->title, "queue/$node->nid"), "class" => "title"), array("data" => format_name($node), "class" => "name"), array("data" => module_invoke($node->type, "node_name", $node), "class" => "type"), array("data" => l(t("vote"), "queue/$node->nid"), "class" => "score"));
}
}
......@@ -148,43 +148,47 @@ function queue_view($nid) {
$node = node_load(array("nid" => $nid, "moderate" => 1));
if ($user->uid != $node->uid && !field_get($node->users, $user->uid)) {
if ($op == t("Vote") && $votes[$edit["vote"]]) {
/*
** If it is a valid vote, record it.
*/
if ($node) {
if ($user->uid != $node->uid && !field_get($node->users, $user->uid)) {
if ($op == t("Vote") && $votes[$edit["vote"]]) {
/*
** If it is a valid vote, record it.
*/
queue_vote($node, $edit["vote"]);
queue_vote($node, $edit["vote"]);
$output = t("Your vote has been recorded.");
}
else {
/*
** Display some explanation or voting guidelines:
*/
$output = t("Your vote has been recorded.");
}
else {
/*
** Display some explanation or voting guidelines:
*/
$output .= "<p>". t("When new content is submitted it goes into the submission queue. Registered users with the appropriate permission can access this queue and vote whether they think the content should be approved or not. When enough people vote to approve the content it is displayed on the front page. On the other hand, if enough people vote to drop it, the content will disappear.") ."</p>";
$output .= "<p>". t("When new content is submitted it goes into the submission queue. Registered users with the appropriate permission can access this queue and vote whether they think the content should be approved or not. When enough people vote to approve the content it is displayed on the front page. On the other hand, if enough people vote to drop it, the content will disappear.") ."</p>";
/*
** Display a voting form:
*/
/*
** Display a voting form:
*/
$output .= form_select(t("Your vote"), "vote", "", $votes);
$output .= form_hidden("id", $node->nid);
$output .= form_submit(t("Vote"));
$output .= form_select(t("Your vote"), "vote", "", $votes);
$output .= form_hidden("id", $node->nid);
$output .= form_submit(t("Vote"));
$output = form($output);
$output = form($output);
}
}
}
$output .= node_view($node);
if ($output) {
$output .= theme("box", t("Moderate"), $output);
$output .= node_view($node);
$output = theme("box", t("Moderate"), $output);
if ($node->comment && variable_get("queue_show_comments", 1)) {
$output .= module_invoke("comment", "render", $node);
}
print theme("page", $output);
}
if ($node->comment && variable_get("queue_show_comments", 1)) {
$output .= module_invoke("comment", "render", $node);
else {
drupal_not_found();
}
print theme("page", $output);
}
function queue_page() {
......
......@@ -183,7 +183,7 @@ function do_search($search_array) {
$find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr(request_uri(), "admin") ? url("admin/node/edit/$lno") : url("node/view/$lno")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
case "comment":
$find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr(request_uri(), "admin") ? url("admin/comment/edit/$lno") : url("node/view/$nid", NULL, $lno)), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
$find[$i++] = array("count" => $count, "title" => $title, "link" => (strstr(request_uri(), "admin") ? url("admin/comment/edit/$lno") : url("node/view/$nid", NULL, "comment-$lno")), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
break;
}
}
......
......@@ -278,7 +278,7 @@ function statistics_admin_accesslog_table($type, $id) {
$user = user_load(array("uid" => $log->uid));
if ($log->url) {
$url = "<a href=\"$log->url\" title=\"$log->url\">". (strlen($log->url) > 28 ? substr($log->url, 0, 28) . '...' : $log->url) ."</a>";
$url = "<a href=\"$log->url\" title=\"$log->url\">". (strlen($log->url) > 28 ? truncate_utf8($log->url, 28) . '...' : $log->url) ."</a>";
}
else {
$url = message_na();
......@@ -326,7 +326,7 @@ function statistics_top_refer() {
$result = pager_query($query, 50, 0, $query_cnt);
while ($referrer = db_fetch_array($result)) {
$rows[] = array("<a href=\"". $referrer["url"] ."\">". substr($referrer["url"], 0, 100) ."</a>", format_date($referrer["last_view"], "small"), $referrer["count"]);
$rows[] = array("<a href=\"". $referrer["url"] ."\">". truncate_utf8($referrer["url"], 100) ."</a>", format_date($referrer["last_view"], "small"), $referrer["count"]);
}
if ($pager = theme("pager", NULL, 50, 0, tablesort_pager())) {
$rows[] = array(array("data" => $pager, "colspan" => 3));
......@@ -392,14 +392,14 @@ function statistics_settings() {
$output .= form_group(t("Content viewing counter settings"), $group);
// Popular content block settings
$numbers = array_merge(array("0" => t("Disabled")), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40)));
$numbers = array("0" => t("Disabled")) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
$group = form_select(t("Number of day's top views to display"), "statistics_block_top_day_num", variable_get("statistics_block_top_day_num", 0), $numbers, t("How many content items to display in \"day\" list. Requires enabled content viewing counters."));
$group .= form_select(t("Number of all time views to display"), "statistics_block_top_all_num", variable_get("statistics_block_top_all_num", 0), $numbers, t("How many content items to display in \"all time\" list. Requires enabled content viewing counters."));
$group .= form_select(t("Number of most recent views to display"), "statistics_block_top_last_num", variable_get("statistics_block_top_last_num", 0), $numbers, t("How many content items to display in \"recently viewed\" list. Requires enabled content viewing counters."));
$output .= form_group(t("\"Popular content\" block settings"), $group);
// Popular content page settings
$numbers = array_merge(array("0" => t("Disabled")), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25)));
$numbers = array("0" => t("Disabled")) + drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25));
$group = form_textfield(t("Name for link to user page"), "statistics_userpage_link", variable_get("statistics_userpage_link", ""), 20, 40, t("This node generates a user page listing your site's most popular content. If you specify a name here, a link to the \"Popular content\" page will be added automatically."));
$group .= form_select(t("Number of day's top views to display"), "statistics_userpage_day_cnt", variable_get("statistics_userpage_day_cnt", 0), $numbers, t("How many content items to display in the \"day\" list. Requires enabled content viewing counters."));
$group .= form_select(t("Number of all time top views to display"), "statistics_userpage_all_cnt", variable_get("statistics_userpage_all_cnt", 0), $numbers, t("How many content items to display in the \"all time\" list. Requires enabled content viewing counters."));
......
......@@ -37,7 +37,7 @@ function taxonomy_link($type, $node = NULL) {
if ($node->taxonomy) {
foreach ($node->taxonomy as $tid) {
$term = taxonomy_get_term($tid);
$links[] = l($term->name, "taxonomy/page/or/$term->tid");
$links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array ('title' => $term->description) : array());
}
}
else {
......@@ -52,7 +52,7 @@ function taxonomy_link($type, $node = NULL) {
$links = array();
foreach (taxonomy_node_get_terms($node->nid) as $term) {
$links[] = l($term->name, "taxonomy/page/or/$term->tid");
$links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array ('title' => $term->description) : array());
}
}
......@@ -73,7 +73,7 @@ function taxonomy_form_vocabulary($edit = array()) {
$form .= form_textarea(t("Description"), "description", $edit["description"], 60, 5, t("Optional") .". ". t("Description of the vocabulary, can be used by modules."));
$form .= form_select(t("Types"), "nodes", explode(",", $edit["nodes"]), $nodetypes, t("Required") .". ". t("A list of node types you want to associate this vocabulary with."), "", 1);
$form .= form_checkbox(t("Related terms"), "relations", 1, $edit["relations"], t("Optional") .". ". t("Allows <a href=\"%help-url\">related terms</a> in this vocabulary.", array("%help-url" => url("admin/taxonomy/help", NULL, NULL, "related-terms"))));
$form .= form_radios(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") .". ". t("Allows <a href=\"%help-url\">a tree-like hierarchy</a> between terms of this vocabulary.", array("%help-url" => url("admin/taxonomy/help", NULL, NULL, "hierarchy"))), "", 0);
$form .= form_radios(t("Hierarchy"), "hierarchy", $edit["hierarchy"], array(t("Disabled"), t("Single"), t("Multiple")), t("Optional") .". ". t("Allows <a href=\"%help-url\">a tree-like hierarchy</a> between terms of this vocabulary.", array("%help-url" => url("admin/taxonomy/help", NULL, NULL, "hierarchy"))), "");
$form .= form_checkbox(t("Multiple select"), "multiple", 1, $edit["multiple"], t("Optional") .". ". t("Allows nodes to have more than one term in this vocabulary."));
$form .= form_checkbox(t("Required"), "required", 1, $edit["required"], t("If enabled every node <strong>must</strong> have at least one term in this vocabulary"));
$form .= form_weight(t("Weight"), "weight", $edit["weight"], 10, t("Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top."));
......@@ -395,7 +395,9 @@ function taxonomy_node_save($nid, $terms) {
if ($terms) {
foreach ($terms as $term) {
db_query("INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)", $nid, $term);
if ($term) {
db_query("INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)", $nid, $term);
}
}
}
}
......
......@@ -34,7 +34,7 @@ function user_load($array = array()) {
$query .= "u.$key = '". md5($value) ."' AND ";
}
else {
$query .= "u.$key = '". check_query($value) ."' AND ";
$query .= "LOWER(u.$key) = '". strtolower(check_query($value)) ."' AND ";
}
}
$result = db_query_range("SELECT u.*, r.name AS role FROM {role} r INNER JOIN {users} u ON r.rid = u.rid WHERE $query u.status < 3", 0, 1);
......@@ -296,7 +296,11 @@ function user_perm() {
function user_search($keys) {
$find = array();
$result = db_query_range("SELECT * FROM {users} WHERE name LIKE '%%%s%%'", $keys, 0, 20);
// Replace wildcards with (MySQL/PostgreSQL wildcards
$keys = str_replace("*", "%", $keys);
$result = db_query_range("SELECT * FROM {users} WHERE LOWER(name) LIKE '%%%s%%'", strtolower($keys), 0, 20);
while ($account = db_fetch_object($result)) {
$find[] = array("title" => $account->name, "link" => (strstr(request_uri(), "admin") ? url("admin/user/edit/$account->uid") : url("user/view/$account->uid")), 'user' => $account->name);
}
......@@ -696,11 +700,11 @@ function user_pass($edit = array()) {
global $base_url;
if ($edit['name']) {
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND name = '%s'", $edit['name']));
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(name) = '%s'", strtolower($edit['name'])));
if (!$account) $error = t("Sorry. The username <i>%s</i> is not recognized.", array("%s" => $edit['name']));
}
else if ($edit['mail']) {
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND mail = '%s'", $edit['mail']));
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM {users} WHERE status = 1 AND LOWER(mail) = '%s'", strtolower($edit['mail'])));
if (!$account) $error = t("Sorry. The e-mail address <i>%s</i> is not recognized.", array("%s" => $edit['mail']));
}
if ($account) {
......@@ -1429,7 +1433,7 @@ function user_admin_edit($edit = array()) {
db_query("DELETE FROM {users} WHERE uid = %d", $account->uid);
db_query("DELETE FROM {authmap} WHERE uid = %d", $account->uid);
drupal_set_message(t("the account has been deleted."));
module_invoke_all('user', "delete", $account, $user);
module_invoke_all('user', 'delete', $edit, $account);
return user_admin_account();
}
else {
......