- Applied Marco's big patch, including contributions from Moshe:
+ Changed the db_query() API. + Wrapped all links in l(), lm(), la(), ..., drupal_url() functions. + XHTML-ified some HTML. + Wrapped a lot of text in the administrative pages in a t() function. + Replaced all $REQUEST_URI/$PATH_INFOs by request_uri(). + Small bugfixes (eg. bug in book_export_html() and clean-ups (eg. RSS code). + Fixed some bugs in the taxonomy module (eg. tree making bug), added new functionality (eg. new APIs for use by other modules), included Moshe's taxonomy extensions, and some documentation udpates. + ...4.0.x
parent
0a966e1ed4
commit
8043cb998f
|
@ -51,5 +51,4 @@ function admin_page($mod) {
|
|||
if (user_access("access administration pages")) {
|
||||
admin_page($mod);
|
||||
}
|
||||
|
||||
?>
|
|
@ -2,7 +2,7 @@
|
|||
// $Id$
|
||||
|
||||
function conf_init() {
|
||||
global $HTTP_HOST, $REQUEST_URI;
|
||||
global $HTTP_HOST;
|
||||
|
||||
/*
|
||||
** Try finding a matching configuration file by stripping the website's
|
||||
|
@ -10,7 +10,7 @@ function conf_init() {
|
|||
** default value 'conf'.
|
||||
*/
|
||||
|
||||
$file = strtolower(strtr($HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")), "/:", ".."));
|
||||
$file = strtolower(strtr($HTTP_HOST . substr(request_uri(), 0, strrpos(request_uri(), "/")), "/:", ".."));
|
||||
|
||||
while (strlen($file) > 4) {
|
||||
if (file_exists("includes/$file.php")) {
|
||||
|
@ -27,7 +27,7 @@ function conf_init() {
|
|||
function error_handler($errno, $message, $filename, $line, $variables) {
|
||||
$types = array(1 => "error", 2 => "warning", 4 => "parse error", 8 => "notice", 16 => "core error", 32 => "core warning", 64 => "compile error", 128 => "compile warning", 256 => "user error", 512 => "user warning", 1024 => "user notice");
|
||||
$entry = $types[$errno] .": $message in $filename on line $line.";
|
||||
if (($errno == 1 || $errno == 2 || $errno == 4) && error_reporting()) {
|
||||
if (($errno == 1 || $errno == 2 || $errno == 4 || $errno == 256) && error_reporting()) {
|
||||
watchdog("error", $types[$errno] .": $message in $filename on line $line.");
|
||||
print $entry;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ function error_handler($errno, $message, $filename, $line, $variables) {
|
|||
|
||||
function watchdog($type, $message) {
|
||||
global $user;
|
||||
db_query("INSERT INTO watchdog (uid, type, message, location, hostname, timestamp) VALUES ('$user->uid', '". check_input($type) ."', '". check_input($message) ."', '". check_input(getenv("REQUEST_URI")) ."', '". check_input(getenv("REMOTE_ADDR")) ."', '". time() ."')");
|
||||
db_query("INSERT INTO watchdog (uid, type, message, location, hostname, timestamp) VALUES ('$user->uid', '%s', '%s', '%s', '%s', '%s')", $type, $message, getenv("PATH_INFO"), getenv("REMOTE_ADDR"), time());
|
||||
}
|
||||
|
||||
function throttle($type, $rate) {
|
||||
|
@ -79,14 +79,18 @@ function object2array($node) {
|
|||
}
|
||||
|
||||
function path_uri($brief = 0) {
|
||||
global $HTTP_HOST, $REQUEST_URI;
|
||||
$path = $HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")) ."/";
|
||||
global $HTTP_HOST;
|
||||
$path = $HTTP_HOST . substr(request_uri(), 0, strrpos(request_uri(), "/")) ."/";
|
||||
if (!$brief) {
|
||||
$path = "http://". $path;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
function request_uri() {
|
||||
return getenv("REQUEST_URI");
|
||||
}
|
||||
|
||||
function path_img() {
|
||||
// use "http://your-image-server.com/ if you want to host images on a seperate server.
|
||||
return "./images/";
|
||||
|
@ -109,9 +113,13 @@ function locale_init() {
|
|||
return ($languages ? (($user->uid && $user->language) ? $user->language : key($languages)) : 0);
|
||||
}
|
||||
|
||||
function t($string) {
|
||||
function t($string, $args = 0) {
|
||||
global $languages;
|
||||
return ($languages && function_exists("locale") ? locale($string) : $string);
|
||||
if (!$args) {
|
||||
return $string;
|
||||
} else {
|
||||
return strtr($string, $args);
|
||||
}
|
||||
}
|
||||
|
||||
function variable_init($conf = array()) {
|
||||
|
@ -134,8 +142,8 @@ function variable_get($name, $default, $object = 0) {
|
|||
function variable_set($name, $value) {
|
||||
global $conf;
|
||||
|
||||
db_query("DELETE FROM variable WHERE name = '". check_query($name) ."'");
|
||||
db_query("INSERT INTO variable (name, value) VALUES ('". check_query($name) ."', '". check_query($value) ."')");
|
||||
db_query("DELETE FROM variable WHERE name = '%s'", $name);
|
||||
db_query("INSERT INTO variable (name, value) VALUES ('%s', '%s')", $name, $value);
|
||||
|
||||
$conf[$name] = $value;
|
||||
}
|
||||
|
@ -143,7 +151,7 @@ function variable_set($name, $value) {
|
|||
function variable_del($name) {
|
||||
global $conf;
|
||||
|
||||
db_query("DELETE FROM variable WHERE name = '". check_query($name) ."'");
|
||||
db_query("DELETE FROM variable WHERE name = '%s'", $name);
|
||||
|
||||
unset($conf[$name]);
|
||||
}
|
||||
|
@ -182,7 +190,7 @@ function search_form($action = 0, $query = 0, $options = 0) {
|
|||
global $keys;
|
||||
|
||||
if (!$action) {
|
||||
$action = "module.php?mod=search";
|
||||
$action = drupal_url(array("mod" => "search"), "module");
|
||||
}
|
||||
|
||||
if (!$query) {
|
||||
|
@ -308,9 +316,9 @@ function drupal_goto($url) {
|
|||
*/
|
||||
|
||||
function referer_save() {
|
||||
global $referer, $HTTP_REFERER, $REQUEST_URI;
|
||||
global $referer, $HTTP_REFERER;
|
||||
|
||||
if (!strstr($HTTP_REFERER, $REQUEST_URI)) {
|
||||
if (!strstr($HTTP_REFERER, request_uri())) {
|
||||
$referer = $HTTP_REFERER;
|
||||
session_register("referer");
|
||||
}
|
||||
|
@ -422,21 +430,21 @@ function format_size($size) {
|
|||
}
|
||||
|
||||
function cache_get($key) {
|
||||
$cache = db_fetch_object(db_query("SELECT data FROM cache WHERE cid = '". check_query($key) ."'"));
|
||||
$cache = db_fetch_object(db_query("SELECT data FROM cache WHERE cid = '%s'", $key));
|
||||
return $cache->data ? $cache->data : 0;
|
||||
}
|
||||
|
||||
function cache_set($cid, $data, $expire = 0) {
|
||||
if (db_fetch_object(db_query("SELECT cid FROM cache WHERE cid = '". check_query($cid) ."'"))) {
|
||||
db_query("UPDATE cache SET data = '". check_query($data) ."' WHERE cid = '". check_query($cid) ."'");
|
||||
if (db_fetch_object(db_query("SELECT cid FROM cache WHERE cid = '%s'", $cid))) {
|
||||
db_query("UPDATE cache SET data = '%s' WHERE cid = '%s'", $data, $cid);
|
||||
}
|
||||
else {
|
||||
db_query("INSERT INTO cache (cid, data, expire) VALUES('". check_query($cid) ."', '". check_query($data) ."', '". check_query($expire) ."')");
|
||||
db_query("INSERT INTO cache (cid, data, expire) VALUES('%s', '%s', '%s')", $cid, $data, $expire);
|
||||
}
|
||||
}
|
||||
|
||||
function cache_del($cid) {
|
||||
db_query("DELETE FROM cache WHERE cid = '". check_query($cid) ."'");
|
||||
db_query("DELETE FROM cache WHERE cid = '%s'", $cid);
|
||||
}
|
||||
|
||||
function cache_clear() {
|
||||
|
@ -444,20 +452,20 @@ function cache_clear() {
|
|||
}
|
||||
|
||||
function page_set_cache() {
|
||||
global $user, $REQUEST_URI, $REQUEST_METHOD;
|
||||
global $user, $REQUEST_METHOD;
|
||||
|
||||
if (!$user->uid && $REQUEST_METHOD == "GET") {
|
||||
if ($data = ob_get_contents()) {
|
||||
cache_set($REQUEST_URI, $data, (time() + variable_get("cache_clear", 30)));
|
||||
cache_set(request_uri(), $data, (time() + variable_get("cache_clear", 30)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function page_get_cache() {
|
||||
global $user, $REQUEST_URI, $REQUEST_METHOD;
|
||||
global $user, $REQUEST_METHOD;
|
||||
|
||||
if (!$user->uid && $REQUEST_METHOD == "GET") {
|
||||
if ($cache = cache_get($REQUEST_URI)) {
|
||||
if ($cache = cache_get(request_uri())) {
|
||||
cache_clear();
|
||||
}
|
||||
else {
|
||||
|
@ -519,10 +527,10 @@ function format_name($object) {
|
|||
|
||||
if ($object->uid && $object->name) {
|
||||
if (strstr($PHP_SELF, "admin.php")) {
|
||||
$output = "<a href=\"admin.php?mod=user&op=edit&id=$object->uid\">$object->name</a>";
|
||||
$output = la($object->name, array("mod" => "user", "op" => "edit", "id" => $object->uid));
|
||||
}
|
||||
else {
|
||||
$output = "<a href=\"module.php?mod=user&op=view&id=$object->uid\">$object->name</a>";
|
||||
$output = lm($object->name, array("mod" => "user", "op" => "view", "id" => $object->uid));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -542,13 +550,11 @@ function format_url($address, $description = 0) {
|
|||
}
|
||||
|
||||
function format_tag($link, $text) {
|
||||
return "'<a href=\"node.php?title='. urlencode('$link') .'\">'. ('$text' ? '$text' : '$link') .'</a>'";
|
||||
return l(('$text' ? '$text' : '$link'), array("title" => urlencode('$link')));
|
||||
}
|
||||
|
||||
function form($form, $method = "post", $action = 0, $options = 0) {
|
||||
global $REQUEST_URI;
|
||||
|
||||
return "<form action=\"". ($action ? $action : $REQUEST_URI) ."\" method=\"$method\"". ($options ? " $options" : "") .">\n$form</form>\n";
|
||||
return "<form action=\"". ($action ? $action : request_uri()) ."\" method=\"$method\"". ($options ? " $options" : "") .">\n$form</form>\n";
|
||||
}
|
||||
|
||||
function form_item($title, $value, $description = 0) {
|
||||
|
@ -592,6 +598,44 @@ function form_submit($value) {
|
|||
return "<input type=\"submit\" name=\"op\" value=\"". check_form($value) ."\" />\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an url; use this functions when you must write an url
|
||||
* for example in a form or a redirect
|
||||
*
|
||||
* @param $args dictionary of arguments to be passed to the script
|
||||
* @param $script script to be invoked; optional, defaults to node
|
||||
*/
|
||||
function drupal_url($args = array(), $script = "node") {
|
||||
$t = array();
|
||||
foreach($args as $k => $v) {
|
||||
$t[] = "$k=$v";
|
||||
}
|
||||
return "$script.php?".implode("&", $t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an html link; use this functions when you must write a link
|
||||
* to another drupal page
|
||||
*
|
||||
* @param $args dictionary of arguments to be passed to the script
|
||||
* @param $linktext text of the link
|
||||
* @param $title optional, popup title
|
||||
* @param $script script to be invoked; optional, defaults to node
|
||||
*/
|
||||
function l($linktext, $args = array(), $title = "", $script = "node") {
|
||||
return "<a href=\"".drupal_url($args, $script)."\" title=\"$title\">$linktext</a>";
|
||||
}
|
||||
|
||||
function la($linktext, $args = array(), $title = "") {
|
||||
// we don't call l() to avoid another duplication of the array
|
||||
return "<a href=\"".drupal_url($args, "admin")."\" title=\"$title\">$linktext</a>";
|
||||
}
|
||||
|
||||
function lm($linktext, $args = array(), $title = "") {
|
||||
// we don't call l() to avoid another duplication of the array
|
||||
return "<a href=\"".drupal_url($args, "module")."\" title=\"$title\">$linktext</a>";
|
||||
}
|
||||
|
||||
function field_get($string, $name) {
|
||||
ereg(",$name=([^,]+)", ",$string", $regs);
|
||||
return $regs[1];
|
||||
|
|
|
@ -9,7 +9,31 @@ function db_connect($url) {
|
|||
// NOTE: we are using a persistent connection!
|
||||
}
|
||||
|
||||
function db_query($query, $debug = 0) {
|
||||
function db_query($query) {
|
||||
$args = func_get_args();
|
||||
if (count($args) > 1) {
|
||||
$args = array_map("check_query", $args);
|
||||
$args[0] = $query;
|
||||
return _db_query(call_user_func_array("sprintf", $args));
|
||||
} else {
|
||||
return _db_query($query);
|
||||
}
|
||||
}
|
||||
|
||||
// debug version
|
||||
function db_queryd($query) {
|
||||
$args = func_get_args();
|
||||
if (count($args) > 1) {
|
||||
$args = array_map("check_query", $args);
|
||||
$args[0] = $query;
|
||||
return _db_query(call_user_func_array("sprintf", $args), 1);
|
||||
} else {
|
||||
return _db_query($query, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// private
|
||||
function _db_query($query, $debug = 0) {
|
||||
global $queries;
|
||||
|
||||
if (variable_get("dev_query", 0)) {
|
||||
|
@ -22,11 +46,10 @@ function db_query($query, $debug = 0) {
|
|||
print "<p>query: $query<br />error:". mysql_error() ."</p>";
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
if (!mysql_errno()) {
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
watchdog("error", "database: ". mysql_error() ."\nquery: ". htmlspecialchars($query));
|
||||
} else {
|
||||
trigger_error(mysql_error() ."\nquery: ". htmlspecialchars($query), E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class BaseTheme {
|
|||
$output .= "<div style=\"border: 1px solid; padding: 10px;\">";
|
||||
$output .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
|
||||
$output .= " <tr><td><div style=\"font-size: 110%; font-weight: bold;\">". check_output($comment->subject) ."</div></td><td align=\"right\" rowspan=\"2\" valign=\"top\">". comment_moderation($comment) ."</td></tr>";
|
||||
$output .= " <tr><td><div style=\"margin-left: 10px; padding-bottom: 10px; font-size: 90%;\">". sprintf(t("by %s on %s"), format_name($comment), format_date($comment->timestamp)) ."</div></td></tr>";
|
||||
$output .= " <tr><td><div style=\"margin-left: 10px; padding-bottom: 10px; font-size: 90%;\">". t("by %a on %b", array("%a" => format_name($comment), "%b" => format_date($comment->timestamp))) ."</div></td></tr>";
|
||||
$output .= " <tr><td colspan=\"2\">". check_output($comment->comment, 1) ."</td></tr>";
|
||||
$output .= " <tr><td align=\"right\" colspan=\"2\">$link</td></tr>";
|
||||
$output .= "</table>";
|
||||
|
@ -113,10 +113,10 @@ function theme_init() {
|
|||
}
|
||||
|
||||
function theme_blocks($region, &$theme) {
|
||||
global $id, $PHP_SELF, $REQUEST_URI, $user;
|
||||
global $id, $PHP_SELF, $user;
|
||||
|
||||
if ($user->uid) {
|
||||
$result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.uid = '$user->uid'))". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." AND (b.path = '' OR '". strrchr($REQUEST_URI, "/") ."' RLIKE b.path) ORDER BY weight");
|
||||
$result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.uid = '$user->uid'))". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." AND (b.path = '' OR '". strrchr(request_uri(), "/") ."' RLIKE b.path) ORDER BY weight");
|
||||
}
|
||||
else {
|
||||
$result = db_query("SELECT * FROM blocks WHERE status = 2". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND region = 0" : " AND region = 1") : "") ." ORDER BY weight");
|
||||
|
|
|
@ -25,11 +25,11 @@ function import_perm() {
|
|||
|
||||
function import_link($type) {
|
||||
if ($type == "admin" && user_access("administer news feeds")) {
|
||||
$links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
|
||||
$links[] = la(t("news feeds"), array("mod" => "import"));
|
||||
}
|
||||
|
||||
if ($type == "page" && user_access("access news feeds")) {
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("news feeds") ."</a>";
|
||||
$links[] = lm(t("news feeds"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -53,9 +53,10 @@ function import_format_item($item, $feed = 0) {
|
|||
global $theme, $user;
|
||||
|
||||
if ($user->uid && user_access("post blogs")) {
|
||||
$output .= "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\"><img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" /></a> ";
|
||||
$output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
}
|
||||
|
||||
// external link
|
||||
$output .= "<a href=\"". check_output($item->link) ."\" target=\"new\">". check_output($item->title) ."</a>";
|
||||
|
||||
return $output ."<br />";
|
||||
|
@ -78,7 +79,7 @@ function import_bundle_block($attributes) {
|
|||
}
|
||||
|
||||
function import_feed_block($feed) {
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '$feed->fid' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15), $feed->fid);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= import_format_item($item);
|
||||
|
@ -97,7 +98,7 @@ function import_get_bundles($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $bundle->title;
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\" title=\"". t("View this bundle's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), t("View this bundle's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$bundle->title bundle";
|
||||
|
||||
$i++;
|
||||
|
@ -112,7 +113,7 @@ function import_get_feeds($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $feed->title;
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\" title=\"". t("View this feed's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), t("View this feed's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$feed->title feed";
|
||||
|
||||
$i++;
|
||||
|
@ -122,7 +123,7 @@ function import_get_feeds($attributes = 0) {
|
|||
}
|
||||
|
||||
function import_remove($feed) {
|
||||
db_query("DELETE FROM item WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $feed["fid"]);
|
||||
return "feed '". $feed["title"] ."' reset.";
|
||||
}
|
||||
|
||||
|
@ -175,7 +176,7 @@ function import_refresh($feed) {
|
|||
$link = strip_tags($link[1]);
|
||||
$description = filter(strtr($description[1], $tt));
|
||||
|
||||
db_query("UPDATE feed SET timestamp = '". time() ."', link = '". check_input($link) ."', description = '". check_input($description) ."' WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("UPDATE feed SET timestamp = '%s', link = '%s', description = '%s' WHERE fid = '%s'",time(), $link, $description, $feed["fid"]);
|
||||
|
||||
/*
|
||||
** Extract and process individual items:
|
||||
|
@ -214,10 +215,10 @@ function import_refresh($feed) {
|
|||
*/
|
||||
|
||||
if ($link && $link != $feed["link"] && $link != $feed["url"]) {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND link = '". check_query($link) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND link = '%s'", $feed["fid"], $link));
|
||||
}
|
||||
else {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND title = '". check_query($title) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND title = '%s'", $feed["fid"], $title));
|
||||
}
|
||||
|
||||
import_save_item(array(iid => $entry->iid, fid => $feed["fid"], title => $title, link => $link, author => $author, description => $description, attributes => $feed["attributes"]));
|
||||
|
@ -230,7 +231,7 @@ function import_refresh($feed) {
|
|||
|
||||
unset($items);
|
||||
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '". $feed["fid"] ."' ORDER BY timestamp");
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '%s' ORDER BY timestamp", $feed["fid"]);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$items[] = "iid = '$item->iid'";
|
||||
|
@ -250,13 +251,13 @@ function import_refresh($feed) {
|
|||
|
||||
function import_save_item($edit) {
|
||||
if ($edit["iid"] && $edit["title"]) {
|
||||
db_query("UPDATE item SET title = '". check_input($edit["title"]) ."', link = '". check_input($edit["link"]) ."', author = '". check_input($edit["author"]) ."', description = '". check_input($edit["description"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("UPDATE item SET title = '%s', link = '%s', author = '%s', description = '%s', attributes = '%s' WHERE iid = '%s'", $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], $edit["iid"]);
|
||||
}
|
||||
else if ($edit["iid"]) {
|
||||
db_query("DELETE FROM item WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE iid = '%s'", $edit["iid"]);
|
||||
}
|
||||
else if ($edit["title"] && $edit["link"]) {
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit["fid"]) ."', '". check_input($edit["title"]) ."', '". check_input($edit["link"]) ."', '". check_input($edit["author"]) ."', '". check_input($edit["description"]) ."', '". check_input($edit["attributes"]) ."', '". time() ."')");
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,13 +278,13 @@ function import_form_bundle($edit = array()) {
|
|||
|
||||
function import_save_bundle($edit) {
|
||||
if ($edit["bid"] && $edit["title"]) {
|
||||
db_query("UPDATE bundle SET title = '". check_input($edit["title"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("UPDATE bundle SET title = '%s', attributes = '%s' WHERE bid = '%s'", $edit["title"], $edit["attributes"], $edit["bid"]);
|
||||
}
|
||||
else if ($edit["bid"]) {
|
||||
db_query("DELETE FROM bundle WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("DELETE FROM bundle WHERE bid = '%s'", $edit["bid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["attributes"]) ."')");
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('%s', '%s')", $edit["title"], $edit["attributes"]);
|
||||
}
|
||||
|
||||
module_rehash_blocks("import");
|
||||
|
@ -314,31 +315,31 @@ function import_form_feed($edit = array()) {
|
|||
|
||||
function import_save_feed($edit) {
|
||||
if ($edit["fid"] && $edit["title"]) {
|
||||
db_query("UPDATE feed SET title = '". check_input($edit["title"]) ."', url = '". check_input($edit["url"]) ."', attributes = '". check_input($edit["attributes"]) ."', refresh = '". check_input($edit["refresh"]) ."' WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = '%s'", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["fid"]) {
|
||||
db_query("DELETE FROM feed WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM feed WHERE fid = '%s'", $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["url"]) ."', '". check_input($edit["attributes"]) ."', '". check_input($edit["refresh"]) ."')");
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('%s', '%s', '%s', '%s')", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
|
||||
}
|
||||
}
|
||||
|
||||
function import_save_attributes($edit) {
|
||||
foreach ($edit as $iid => $value) {
|
||||
db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'");
|
||||
db_query("UPDATE item SET attributes = '%s' WHERE iid = '%s'", $value, $iid);
|
||||
}
|
||||
return "attributes has been saved";
|
||||
}
|
||||
|
||||
function import_get_feed($fid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
}
|
||||
|
||||
function import_get_bundle($bid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
}
|
||||
|
||||
function import_view() {
|
||||
|
@ -348,7 +349,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>items</th><th>last update</th><th>next update</th><th colspan=\"3\">operations</th></tr>\n";
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td><a href=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</a></td><td><a href=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</a></td><td><a href=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td>".la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid))."</td><td>" .la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)). "</td><td>". la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)). "</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -358,7 +359,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>operations</th></tr>\n";
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td><a href=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td>".la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -402,7 +403,7 @@ function import_fd_collect($edit) {
|
|||
$title = strip_tags(strtr($title[1], $tt));
|
||||
|
||||
// print "<b>title = $title, link = $link<br /></b>";
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '". check_input($link) ."'"))) {
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) {
|
||||
$output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />";
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +432,7 @@ function import_tag() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>time</th><th>feed</th><th>item</th></tr>\n";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\"><a href=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</a></td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".la(check_output($item->feed), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid))."</td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
$output .= "<input type=\"submit\" name=\"op\" value=\"Save attributes\" />\n";
|
||||
|
@ -444,7 +445,14 @@ function import_admin() {
|
|||
|
||||
if (user_access("administer news feeds")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=import&type=feed&op=add\">add new feed</a> | <a href=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</a> | <a href=\"admin.php?mod=import&op=fd\">import feeds</a> | <a href=\"admin.php?mod=import&op=tag\">tag items</a> | <a href=\"admin.php?mod=import&op=view\">overview</a> | <a href=\"admin.php?mod=import&op=help\">help</a></small><hr />";
|
||||
$links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add"));
|
||||
$links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add"));
|
||||
$links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd"));
|
||||
$links[] = la(t("tag items"), array("mod" => "import", "op" => "tag"));
|
||||
$links[] = la(t("overview"), array("mod" => "import", "op" => "view"));
|
||||
$links[] = la(t("help"), array("mod" => "import", "op" => "help"));
|
||||
|
||||
print "<small>".implode(" | ", $links)."</small><hr />";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
@ -514,10 +522,10 @@ function import_admin() {
|
|||
function import_page_info() {
|
||||
global $theme;
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("latest news") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feeds\" title=\"". t("View the latest headlines sorted by source.") ."\">". t("news by source") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=bundles\" title=\"". t("View the latest headlines sorted by topic.") ."\">". t("news by topic") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=sources\" title=\"". t("View a list of all the websites we syndicate from.") ."\">". t("news sources") ."</a>";
|
||||
$links[] = lm(t("latest news"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
$links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), t("View the latest headlines sorted by source."));
|
||||
$links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), t("View the latest headlines sorted by topic."));
|
||||
$links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), t("View a list of all the websites we syndicate from."));
|
||||
|
||||
return "<div align=\"center\">". $theme->links($links) ."</div>";
|
||||
}
|
||||
|
@ -529,11 +537,11 @@ function import_page_last() {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -553,17 +561,17 @@ function import_page_last() {
|
|||
function import_page_feed($fid) {
|
||||
global $theme;
|
||||
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url($feed->link) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div></p>";
|
||||
$header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '". check_input($fid) ."' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
|
||||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
|
@ -586,9 +594,9 @@ function import_page_feed($fid) {
|
|||
function import_page_bundle($bid) {
|
||||
global $theme;
|
||||
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url("module.php?mod=import&op=bundle&id=$bundle->bid") ."</div></p>";
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url(drupal_url(array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "module")) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." ". check_output($bundle->attributes) .".</div></p>";
|
||||
|
||||
$keys = explode(",", $bundle->attributes);
|
||||
|
@ -597,12 +605,12 @@ function import_page_bundle($bid) {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -626,11 +634,11 @@ function import_page_sources() {
|
|||
$result = db_query("SELECT * FROM feed ORDER BY title");
|
||||
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= format_url("module.php?mod=import&op=feed&id=$feed->fid", $feed->title);
|
||||
$output .= format_url(drupal_url(array("mod" => "import", "op" => "feed", "id" => $feed->fid), "module"), $feed->title);
|
||||
$output .= "<div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div><br />";
|
||||
}
|
||||
|
||||
$output .= "<a href=\"module.php?mod=import&op=fd\" title=\"". t("View the list of syndicated websites in XML format.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br />\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), t("View the list of syndicated websites in XML format."))."<br />\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box(t("News feeds"), import_page_info());
|
||||
|
|
|
@ -25,11 +25,11 @@ function import_perm() {
|
|||
|
||||
function import_link($type) {
|
||||
if ($type == "admin" && user_access("administer news feeds")) {
|
||||
$links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
|
||||
$links[] = la(t("news feeds"), array("mod" => "import"));
|
||||
}
|
||||
|
||||
if ($type == "page" && user_access("access news feeds")) {
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("news feeds") ."</a>";
|
||||
$links[] = lm(t("news feeds"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -53,9 +53,10 @@ function import_format_item($item, $feed = 0) {
|
|||
global $theme, $user;
|
||||
|
||||
if ($user->uid && user_access("post blogs")) {
|
||||
$output .= "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\"><img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" /></a> ";
|
||||
$output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
}
|
||||
|
||||
// external link
|
||||
$output .= "<a href=\"". check_output($item->link) ."\" target=\"new\">". check_output($item->title) ."</a>";
|
||||
|
||||
return $output ."<br />";
|
||||
|
@ -78,7 +79,7 @@ function import_bundle_block($attributes) {
|
|||
}
|
||||
|
||||
function import_feed_block($feed) {
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '$feed->fid' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15), $feed->fid);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= import_format_item($item);
|
||||
|
@ -97,7 +98,7 @@ function import_get_bundles($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $bundle->title;
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\" title=\"". t("View this bundle's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), t("View this bundle's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$bundle->title bundle";
|
||||
|
||||
$i++;
|
||||
|
@ -112,7 +113,7 @@ function import_get_feeds($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $feed->title;
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\" title=\"". t("View this feed's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), t("View this feed's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$feed->title feed";
|
||||
|
||||
$i++;
|
||||
|
@ -122,7 +123,7 @@ function import_get_feeds($attributes = 0) {
|
|||
}
|
||||
|
||||
function import_remove($feed) {
|
||||
db_query("DELETE FROM item WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $feed["fid"]);
|
||||
return "feed '". $feed["title"] ."' reset.";
|
||||
}
|
||||
|
||||
|
@ -175,7 +176,7 @@ function import_refresh($feed) {
|
|||
$link = strip_tags($link[1]);
|
||||
$description = filter(strtr($description[1], $tt));
|
||||
|
||||
db_query("UPDATE feed SET timestamp = '". time() ."', link = '". check_input($link) ."', description = '". check_input($description) ."' WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("UPDATE feed SET timestamp = '%s', link = '%s', description = '%s' WHERE fid = '%s'",time(), $link, $description, $feed["fid"]);
|
||||
|
||||
/*
|
||||
** Extract and process individual items:
|
||||
|
@ -214,10 +215,10 @@ function import_refresh($feed) {
|
|||
*/
|
||||
|
||||
if ($link && $link != $feed["link"] && $link != $feed["url"]) {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND link = '". check_query($link) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND link = '%s'", $feed["fid"], $link));
|
||||
}
|
||||
else {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND title = '". check_query($title) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND title = '%s'", $feed["fid"], $title));
|
||||
}
|
||||
|
||||
import_save_item(array(iid => $entry->iid, fid => $feed["fid"], title => $title, link => $link, author => $author, description => $description, attributes => $feed["attributes"]));
|
||||
|
@ -230,7 +231,7 @@ function import_refresh($feed) {
|
|||
|
||||
unset($items);
|
||||
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '". $feed["fid"] ."' ORDER BY timestamp");
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '%s' ORDER BY timestamp", $feed["fid"]);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$items[] = "iid = '$item->iid'";
|
||||
|
@ -250,13 +251,13 @@ function import_refresh($feed) {
|
|||
|
||||
function import_save_item($edit) {
|
||||
if ($edit["iid"] && $edit["title"]) {
|
||||
db_query("UPDATE item SET title = '". check_input($edit["title"]) ."', link = '". check_input($edit["link"]) ."', author = '". check_input($edit["author"]) ."', description = '". check_input($edit["description"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("UPDATE item SET title = '%s', link = '%s', author = '%s', description = '%s', attributes = '%s' WHERE iid = '%s'", $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], $edit["iid"]);
|
||||
}
|
||||
else if ($edit["iid"]) {
|
||||
db_query("DELETE FROM item WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE iid = '%s'", $edit["iid"]);
|
||||
}
|
||||
else if ($edit["title"] && $edit["link"]) {
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit["fid"]) ."', '". check_input($edit["title"]) ."', '". check_input($edit["link"]) ."', '". check_input($edit["author"]) ."', '". check_input($edit["description"]) ."', '". check_input($edit["attributes"]) ."', '". time() ."')");
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,13 +278,13 @@ function import_form_bundle($edit = array()) {
|
|||
|
||||
function import_save_bundle($edit) {
|
||||
if ($edit["bid"] && $edit["title"]) {
|
||||
db_query("UPDATE bundle SET title = '". check_input($edit["title"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("UPDATE bundle SET title = '%s', attributes = '%s' WHERE bid = '%s'", $edit["title"], $edit["attributes"], $edit["bid"]);
|
||||
}
|
||||
else if ($edit["bid"]) {
|
||||
db_query("DELETE FROM bundle WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("DELETE FROM bundle WHERE bid = '%s'", $edit["bid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["attributes"]) ."')");
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('%s', '%s')", $edit["title"], $edit["attributes"]);
|
||||
}
|
||||
|
||||
module_rehash_blocks("import");
|
||||
|
@ -314,31 +315,31 @@ function import_form_feed($edit = array()) {
|
|||
|
||||
function import_save_feed($edit) {
|
||||
if ($edit["fid"] && $edit["title"]) {
|
||||
db_query("UPDATE feed SET title = '". check_input($edit["title"]) ."', url = '". check_input($edit["url"]) ."', attributes = '". check_input($edit["attributes"]) ."', refresh = '". check_input($edit["refresh"]) ."' WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = '%s'", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["fid"]) {
|
||||
db_query("DELETE FROM feed WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM feed WHERE fid = '%s'", $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["url"]) ."', '". check_input($edit["attributes"]) ."', '". check_input($edit["refresh"]) ."')");
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('%s', '%s', '%s', '%s')", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
|
||||
}
|
||||
}
|
||||
|
||||
function import_save_attributes($edit) {
|
||||
foreach ($edit as $iid => $value) {
|
||||
db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'");
|
||||
db_query("UPDATE item SET attributes = '%s' WHERE iid = '%s'", $value, $iid);
|
||||
}
|
||||
return "attributes has been saved";
|
||||
}
|
||||
|
||||
function import_get_feed($fid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
}
|
||||
|
||||
function import_get_bundle($bid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
}
|
||||
|
||||
function import_view() {
|
||||
|
@ -348,7 +349,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>items</th><th>last update</th><th>next update</th><th colspan=\"3\">operations</th></tr>\n";
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td><a href=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</a></td><td><a href=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</a></td><td><a href=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td>".la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid))."</td><td>" .la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)). "</td><td>". la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)). "</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -358,7 +359,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>operations</th></tr>\n";
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td><a href=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td>".la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -402,7 +403,7 @@ function import_fd_collect($edit) {
|
|||
$title = strip_tags(strtr($title[1], $tt));
|
||||
|
||||
// print "<b>title = $title, link = $link<br /></b>";
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '". check_input($link) ."'"))) {
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) {
|
||||
$output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />";
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +432,7 @@ function import_tag() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>time</th><th>feed</th><th>item</th></tr>\n";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\"><a href=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</a></td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".la(check_output($item->feed), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid))."</td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
$output .= "<input type=\"submit\" name=\"op\" value=\"Save attributes\" />\n";
|
||||
|
@ -444,7 +445,14 @@ function import_admin() {
|
|||
|
||||
if (user_access("administer news feeds")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=import&type=feed&op=add\">add new feed</a> | <a href=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</a> | <a href=\"admin.php?mod=import&op=fd\">import feeds</a> | <a href=\"admin.php?mod=import&op=tag\">tag items</a> | <a href=\"admin.php?mod=import&op=view\">overview</a> | <a href=\"admin.php?mod=import&op=help\">help</a></small><hr />";
|
||||
$links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add"));
|
||||
$links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add"));
|
||||
$links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd"));
|
||||
$links[] = la(t("tag items"), array("mod" => "import", "op" => "tag"));
|
||||
$links[] = la(t("overview"), array("mod" => "import", "op" => "view"));
|
||||
$links[] = la(t("help"), array("mod" => "import", "op" => "help"));
|
||||
|
||||
print "<small>".implode(" | ", $links)."</small><hr />";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
@ -514,10 +522,10 @@ function import_admin() {
|
|||
function import_page_info() {
|
||||
global $theme;
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("latest news") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feeds\" title=\"". t("View the latest headlines sorted by source.") ."\">". t("news by source") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=bundles\" title=\"". t("View the latest headlines sorted by topic.") ."\">". t("news by topic") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=sources\" title=\"". t("View a list of all the websites we syndicate from.") ."\">". t("news sources") ."</a>";
|
||||
$links[] = lm(t("latest news"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
$links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), t("View the latest headlines sorted by source."));
|
||||
$links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), t("View the latest headlines sorted by topic."));
|
||||
$links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), t("View a list of all the websites we syndicate from."));
|
||||
|
||||
return "<div align=\"center\">". $theme->links($links) ."</div>";
|
||||
}
|
||||
|
@ -529,11 +537,11 @@ function import_page_last() {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -553,17 +561,17 @@ function import_page_last() {
|
|||
function import_page_feed($fid) {
|
||||
global $theme;
|
||||
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url($feed->link) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div></p>";
|
||||
$header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '". check_input($fid) ."' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
|
||||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
|
@ -586,9 +594,9 @@ function import_page_feed($fid) {
|
|||
function import_page_bundle($bid) {
|
||||
global $theme;
|
||||
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url("module.php?mod=import&op=bundle&id=$bundle->bid") ."</div></p>";
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url(drupal_url(array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "module")) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." ". check_output($bundle->attributes) .".</div></p>";
|
||||
|
||||
$keys = explode(",", $bundle->attributes);
|
||||
|
@ -597,12 +605,12 @@ function import_page_bundle($bid) {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -626,11 +634,11 @@ function import_page_sources() {
|
|||
$result = db_query("SELECT * FROM feed ORDER BY title");
|
||||
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= format_url("module.php?mod=import&op=feed&id=$feed->fid", $feed->title);
|
||||
$output .= format_url(drupal_url(array("mod" => "import", "op" => "feed", "id" => $feed->fid), "module"), $feed->title);
|
||||
$output .= "<div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div><br />";
|
||||
}
|
||||
|
||||
$output .= "<a href=\"module.php?mod=import&op=fd\" title=\"". t("View the list of syndicated websites in XML format.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br />\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), t("View the list of syndicated websites in XML format."))."<br />\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box(t("News feeds"), import_page_info());
|
||||
|
|
|
@ -33,7 +33,7 @@ function archive_display($original = 0) {
|
|||
// Generate calendar header:
|
||||
$output .= "\n<!-- calendar -->\n";
|
||||
$output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"7\"><small><a href=\"module.php?mod=archive&date=$prev\"><</a> ". date("F Y", $original) ." " . ($next <= $thislast ? "<a href=\"module.php?mod=archive&date=$next\">></a>" : ">") . "</small></td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"7\"><small>".lm("<", array("mod" => "archive", "date" => $prev))." ". date("F Y", $original) ." " . ($next <= $thislast ? lm(">", array("mod" => "archive", "date" => $next)) : ">") . "</small></td></tr>\n";
|
||||
|
||||
// Generate the days of the week:
|
||||
$somesunday = mktime(0, 0, 0, 3, 20, 1994);
|
||||
|
@ -71,7 +71,8 @@ function archive_display($original = 0) {
|
|||
$output .= " <td align=\"center\"><small>$nday</small></td>\n";
|
||||
}
|
||||
else {
|
||||
$output .= " <td align=\"center\"><small><a href=\"module.php?mod=archive&date=$date\" style=\"text-decoration: none;\">$nday</a></small></td>\n";
|
||||
// due to text-decoration we use drupal_url() instead of lm()
|
||||
$output .= " <td align=\"center\"><small><a href=\"".drupal_url(array("mod" => "archive", "date" => $date), "module")." \" style=\"text-decoration: none;\">$nday</a></small></td>\n";
|
||||
}
|
||||
|
||||
// Start every week on a new line:
|
||||
|
@ -108,7 +109,7 @@ function archive_block() {
|
|||
|
||||
function archive_link($type) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=archive\" title=\"". t("Read the older content in our archive.") ."\">archives</a>";
|
||||
$links[] = lm(t("archives"), array("mod" => "archive"), t("Read the older content in our archive."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -156,7 +157,7 @@ function archive_page() {
|
|||
** selected.
|
||||
*/
|
||||
|
||||
$result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_input($date) : time()) ." ORDER BY created LIMIT 20");
|
||||
$result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_query($date) : time()) ." ORDER BY created LIMIT 20");
|
||||
|
||||
while ($nid = db_fetch_object($result)) {
|
||||
node_view(node_load(array("nid" => $nid->nid)), 1);
|
||||
|
|
|
@ -33,7 +33,7 @@ function archive_display($original = 0) {
|
|||
// Generate calendar header:
|
||||
$output .= "\n<!-- calendar -->\n";
|
||||
$output .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"7\"><small><a href=\"module.php?mod=archive&date=$prev\"><</a> ". date("F Y", $original) ." " . ($next <= $thislast ? "<a href=\"module.php?mod=archive&date=$next\">></a>" : ">") . "</small></td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"7\"><small>".lm("<", array("mod" => "archive", "date" => $prev))." ". date("F Y", $original) ." " . ($next <= $thislast ? lm(">", array("mod" => "archive", "date" => $next)) : ">") . "</small></td></tr>\n";
|
||||
|
||||
// Generate the days of the week:
|
||||
$somesunday = mktime(0, 0, 0, 3, 20, 1994);
|
||||
|
@ -71,7 +71,8 @@ function archive_display($original = 0) {
|
|||
$output .= " <td align=\"center\"><small>$nday</small></td>\n";
|
||||
}
|
||||
else {
|
||||
$output .= " <td align=\"center\"><small><a href=\"module.php?mod=archive&date=$date\" style=\"text-decoration: none;\">$nday</a></small></td>\n";
|
||||
// due to text-decoration we use drupal_url() instead of lm()
|
||||
$output .= " <td align=\"center\"><small><a href=\"".drupal_url(array("mod" => "archive", "date" => $date), "module")." \" style=\"text-decoration: none;\">$nday</a></small></td>\n";
|
||||
}
|
||||
|
||||
// Start every week on a new line:
|
||||
|
@ -108,7 +109,7 @@ function archive_block() {
|
|||
|
||||
function archive_link($type) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=archive\" title=\"". t("Read the older content in our archive.") ."\">archives</a>";
|
||||
$links[] = lm(t("archives"), array("mod" => "archive"), t("Read the older content in our archive."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -156,7 +157,7 @@ function archive_page() {
|
|||
** selected.
|
||||
*/
|
||||
|
||||
$result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_input($date) : time()) ." ORDER BY created LIMIT 20");
|
||||
$result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_query($date) : time()) ." ORDER BY created LIMIT 20");
|
||||
|
||||
while ($nid = db_fetch_object($result)) {
|
||||
node_view(node_load(array("nid" => $nid->nid)), 1);
|
||||
|
|
|
@ -18,7 +18,7 @@ function block_perm() {
|
|||
|
||||
function block_link($type) {
|
||||
if ($type == "admin" && user_access("administer blocks")) {
|
||||
$links[] = "<a href=\"admin.php?mod=block\">blocks</a>";
|
||||
$links[] = la(t("blocks"), array("mod" => "block"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -26,7 +26,7 @@ function block_link($type) {
|
|||
|
||||
function block_admin_save($edit) {
|
||||
foreach ($edit as $key=>$value) {
|
||||
db_query("UPDATE blocks SET region = '". check_input($value["region"]) ."', status = '". check_input($value["status"]) ."', path = '". check_input($value["path"]) ."', weight = '". check_input($value["weight"]) ."' WHERE name = '". check_input($key) ."'");
|
||||
db_query("UPDATE blocks SET region = '%s', status = '%s', path = '%s', weight = '%s' WHERE name = '%s'", $value["region"], $value["status"], $value["path"], $value["weight"], $key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ function block_admin_display() {
|
|||
$result = db_query("SELECT * FROM blocks ORDER BY module");
|
||||
|
||||
// Generate output:
|
||||
$output .= "<form action=\"admin.php?mod=block\" method=\"post\">\n";
|
||||
$output .= "<form action=\"".drupal_url(array("mod" => "block"), "admin")." method=\"post\">\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>block</th><th>module</th><th>status</th><th>weight</th><th>region</th><th>path</th></tr>\n";
|
||||
|
||||
while ($block = db_fetch_object($result)) {
|
||||
$module = module_hook($block->module, "admin") ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
|
||||
$module = module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module)) : $block->module;
|
||||
|
||||
$status = "<select name=\"edit[$block->name][status]\">\n";
|
||||
$status .= " <option value=\"2\"". (($block->status == 2) ? " selected" : "") .">enabled: always</option>\n";
|
||||
|
@ -73,40 +73,40 @@ function block_admin_display() {
|
|||
function block_admin_preview() {
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 0 ORDER BY weight");
|
||||
$lblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $lblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$lblocks .= "</TABLE>\n";
|
||||
$lblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $lblocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$lblocks .= "</table>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 1 ORDER BY weight");
|
||||
$rblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $rblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$rblocks .= "</TABLE>\n";
|
||||
$rblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $rblocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$rblocks .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #1:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD>\n". ($lblocks ? $lblocks : " ") ."</TD><TD WIDTH=\"300\"> </TD><TD>\n". ($rblocks ? $rblocks : " ") ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #1:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"3\">header</td></tr>\n";
|
||||
$output .= " <tr><td>\n". ($lblocks ? $lblocks : " ") ."</td><td width=\"300\"> </td><td>\n". ($rblocks ? $rblocks : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"3\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 ORDER BY weight");
|
||||
$blocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $blocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$blocks .= "</TABLE>\n";
|
||||
$blocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $blocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$blocks .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #2:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD WIDTH=\"400\"> </TD><TD>\n". ($blocks ? $blocks : " ") ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #2:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">header</td></tr>\n";
|
||||
$output .= " <tr><td width=\"400\"> </td><td>\n". ($blocks ? $blocks : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #3:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD>\n". ($blocks ? $blocks : " ") ."</TD><TD WIDTH=\"400\"> </TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #3:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">header</td></tr>\n";
|
||||
$output .= " <tr><td>\n". ($blocks ? $blocks : " ") ."</td><td width=\"400\"> </td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
print $output;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ function block_admin() {
|
|||
|
||||
if (user_access("administer blocks")) {
|
||||
|
||||
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=preview\">preview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
|
||||
print "<small>".la(t("configure"), array("mod" => "block"))." | ".la(t("preview"), array("mod" => "block", "op" => "preview"))." | ".la(t("help"), array("mod" => "block", "op" => "help"))."</small><hr>\n";
|
||||
|
||||
block_init();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function block_perm() {
|
|||
|
||||
function block_link($type) {
|
||||
if ($type == "admin" && user_access("administer blocks")) {
|
||||
$links[] = "<a href=\"admin.php?mod=block\">blocks</a>";
|
||||
$links[] = la(t("blocks"), array("mod" => "block"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -26,7 +26,7 @@ function block_link($type) {
|
|||
|
||||
function block_admin_save($edit) {
|
||||
foreach ($edit as $key=>$value) {
|
||||
db_query("UPDATE blocks SET region = '". check_input($value["region"]) ."', status = '". check_input($value["status"]) ."', path = '". check_input($value["path"]) ."', weight = '". check_input($value["weight"]) ."' WHERE name = '". check_input($key) ."'");
|
||||
db_query("UPDATE blocks SET region = '%s', status = '%s', path = '%s', weight = '%s' WHERE name = '%s'", $value["region"], $value["status"], $value["path"], $value["weight"], $key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ function block_admin_display() {
|
|||
$result = db_query("SELECT * FROM blocks ORDER BY module");
|
||||
|
||||
// Generate output:
|
||||
$output .= "<form action=\"admin.php?mod=block\" method=\"post\">\n";
|
||||
$output .= "<form action=\"".drupal_url(array("mod" => "block"), "admin")." method=\"post\">\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>block</th><th>module</th><th>status</th><th>weight</th><th>region</th><th>path</th></tr>\n";
|
||||
|
||||
while ($block = db_fetch_object($result)) {
|
||||
$module = module_hook($block->module, "admin") ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
|
||||
$module = module_hook($block->module, "admin") ? la($block->module, array("mod" => $block->module)) : $block->module;
|
||||
|
||||
$status = "<select name=\"edit[$block->name][status]\">\n";
|
||||
$status .= " <option value=\"2\"". (($block->status == 2) ? " selected" : "") .">enabled: always</option>\n";
|
||||
|
@ -73,40 +73,40 @@ function block_admin_display() {
|
|||
function block_admin_preview() {
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 0 ORDER BY weight");
|
||||
$lblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $lblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$lblocks .= "</TABLE>\n";
|
||||
$lblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $lblocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$lblocks .= "</table>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 AND region = 1 ORDER BY weight");
|
||||
$rblocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $rblocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$rblocks .= "</TABLE>\n";
|
||||
$rblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $rblocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$rblocks .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #1:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD>\n". ($lblocks ? $lblocks : " ") ."</TD><TD WIDTH=\"300\"> </TD><TD>\n". ($rblocks ? $rblocks : " ") ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"3\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #1:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"3\">header</td></tr>\n";
|
||||
$output .= " <tr><td>\n". ($lblocks ? $lblocks : " ") ."</td><td width=\"300\"> </td><td>\n". ($rblocks ? $rblocks : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"3\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM blocks WHERE status > 0 ORDER BY weight");
|
||||
$blocks .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $blocks .= " <TR><TD NOWRAP>". ($block->status == 2 ? "<B>$block->name</B>" : $block->name) ."</TD><TD>$block->weight</TD></TR>\n";
|
||||
$blocks .= "</TABLE>\n";
|
||||
$blocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
while ($block = db_fetch_object($result)) $blocks .= " <tr><td nowrap>". ($block->status == 2 ? "<b>$block->name</b>" : $block->name) ."</td><td>$block->weight</td></tr>\n";
|
||||
$blocks .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #2:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD WIDTH=\"400\"> </TD><TD>\n". ($blocks ? $blocks : " ") ."</TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #2:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">header</td></tr>\n";
|
||||
$output .= " <tr><td width=\"400\"> </td><td>\n". ($blocks ? $blocks : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
$output .= "<H3>layout scheme #3:</H3>\n";
|
||||
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">header</TD></TR>\n";
|
||||
$output .= " <TR><TD>\n". ($blocks ? $blocks : " ") ."</TD><TD WIDTH=\"400\"> </TD></TR>\n";
|
||||
$output .= " <TR><TD ALIGN=\"center\" COLSPAN=\"2\">footer</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<h3>layout scheme #3:</h3>\n";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">header</td></tr>\n";
|
||||
$output .= " <tr><td>\n". ($blocks ? $blocks : " ") ."</td><td width=\"400\"> </td></tr>\n";
|
||||
$output .= " <tr><td align=\"center\" colspan=\"2\">footer</td></tr>\n";
|
||||
$output .= "</table>\n";
|
||||
|
||||
print $output;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ function block_admin() {
|
|||
|
||||
if (user_access("administer blocks")) {
|
||||
|
||||
print "<SMALL><A HREF=\"admin.php?mod=block\">configure</A> | <A HREF=\"admin.php?mod=block&op=preview\">preview</A> | <A HREF=\"admin.php?mod=block&op=help\">help</A></SMALL><HR>\n";
|
||||
print "<small>".la(t("configure"), array("mod" => "block"))." | ".la(t("preview"), array("mod" => "block", "op" => "preview"))." | ".la(t("help"), array("mod" => "block", "op" => "help"))."</small><hr>\n";
|
||||
|
||||
block_init();
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ function blog_access($op, $node) {
|
|||
}
|
||||
|
||||
function blog_save($op, $node) {
|
||||
global $REQUEST_URI;
|
||||
|
||||
if ($op == "approve") {
|
||||
return array("promote" => 1);
|
||||
}
|
||||
|
@ -102,13 +100,13 @@ function blog_feed_user($uid = 0, $date = 0) {
|
|||
|
||||
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.created > '". ($date - 2592000) ."' ORDER BY n.nid DESC LIMIT 15");
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->teaser);
|
||||
$items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser);
|
||||
}
|
||||
|
||||
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
||||
// $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
|
||||
$output .= "<rss version=\"0.91\">\n";
|
||||
$output .= format_rss_channel("$account->name's blog", path_uri() ."module.php?mod=blog&op=view&id=$account->uid", "$account->name's blog", $items);
|
||||
$output .= format_rss_channel("$account->name's blog", path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => $account->uid), "module"), "$account->name's blog", $items);
|
||||
$output .= "</rss>\n";
|
||||
|
||||
header("Content-Type: text/xml");
|
||||
|
@ -121,12 +119,12 @@ function blog_feed_last() {
|
|||
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 15");
|
||||
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->teaser);
|
||||
$items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser);
|
||||
}
|
||||
|
||||
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
||||
$output .= "<rss version=\"0.91\">\n";
|
||||
$output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() ."module.php?mod=blog", "Recently updated blogs.", $items);
|
||||
$output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() . drupal_url(array("mod" => "blog"), "module"), "Recently updated blogs.", $items);
|
||||
$output .= "</rss>\n";
|
||||
|
||||
header("Content-Type: text/xml");
|
||||
|
@ -159,7 +157,7 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
|
|||
|
||||
if ($date != date("dny", $blog->created)) {
|
||||
$date = date("dny", $blog->created);
|
||||
$output .= "<tr><td colspan=\"2\"><b><a href=\"module.php?mod=blog&id=$blog->uid&date=". mktime(23, 59, 59, date("n", $blog->created), date("d", $blog->created), date("Y", $blog->created)) ."\" title=\"". t("Permanent link to this blog entry.") ."\">". format_date($blog->created, custom, "d M Y") .":</a></b></td></tr>";
|
||||
$output .= "<tr><td colspan=\"2\"><b>".lm(format_date($blog->created, custom, "d M Y"), array("mod" => "blog", "id" => $blog->uid, "date" => mktime(23, 59, 59, date("n", $blog->created), date("d", $blog->created), date("Y", $blog->created))), t("Permanent link to this blog entry."))."</b></td></tr>";
|
||||
}
|
||||
|
||||
$links = link_node($blog, 1);
|
||||
|
@ -170,15 +168,15 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
|
|||
}
|
||||
|
||||
$output .= "</table>";
|
||||
$output .= "<a href=\"module.php?mod=blog&op=feed&id=$account->uid\" title=\"". t("Read the XML version of this page.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), t("Read the XML version of this page."))."\n";
|
||||
if (!$all) {
|
||||
$output .= "<a href=\"module.php?mod=blog&op=view&id=$account->uid&all=1\" title=\"". t("Show all blogs by this user") ."\">". t("show all blogs") ."</a>";
|
||||
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), t("Show all blogs by this user"));
|
||||
}
|
||||
else {
|
||||
$output .= "<a href=\"module.php?mod=blog&op=view&id=$account->uid\" title=\"". t("Show recent blogs by this user") ."\">". t("show recent blogs") ."</a>";
|
||||
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), t("Show recent blogs by this user"));
|
||||
}
|
||||
|
||||
$theme->box(strtr(t("%u's blog"), array("%u" => $account->name)), $output);
|
||||
$theme->box(t("%u's blog", array("%u" => $account->name)), $output);
|
||||
}
|
||||
|
||||
function blog_page_last() {
|
||||
|
@ -199,7 +197,7 @@ function blog_page_last() {
|
|||
}
|
||||
|
||||
$output .= "</table>";
|
||||
$output .= "<a href=\"module.php?mod=blog&op=feed\" title=\"". t("Read the XML version of this page.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), t("Read the XML version of this page."))."\n";
|
||||
|
||||
$theme->box(t("User blogs"), $output, "main");
|
||||
}
|
||||
|
@ -231,10 +229,10 @@ function blog_form(&$node, &$help, &$error) {
|
|||
*/
|
||||
|
||||
if ($nid && $blog = node_load(array("nid" => $nid))) {
|
||||
$node->body = "<i>". $blog->body ."</i> [<a href=\"module.php?mod=blog&id=$blog->uid&date=$blog->created\">$blog->name</a>]";
|
||||
$node->body = "<i>". $blog->body ."</i> [".lm($blog->name, array("mod" => "blog", "id" => $blog->uid, "date" => $blog->created))."]";
|
||||
}
|
||||
|
||||
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '". check_input($iid) ."' AND i.fid = f.fid"))) {
|
||||
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%s' AND i.fid = f.fid", $iid))) {
|
||||
$node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n";
|
||||
}
|
||||
}
|
||||
|
@ -287,24 +285,24 @@ function blog_link($type, $node = 0, $main) {
|
|||
global $user;
|
||||
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=blog\" title=\"". t("Read the latest blog entries.") ."\">". t("user blogs") ."</a>";
|
||||
$links[] = lm(t("user blogs"), array("mod" => "blog"), t("Read the latest blog entries."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Add a new personal blog entry.") ."\">". t("create blog entry") ."</a>";
|
||||
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), t("Add a new personal blog entry."));
|
||||
}
|
||||
|
||||
if ($type == "menu.view" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=blog&op=view&id=$user->uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view personal blog") ."</a>";
|
||||
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), t("Read your latest blog entries."));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->type == "blog") {
|
||||
global $op;
|
||||
if (blog_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Edit this blog entry.") ."\">". t("edit this blog") ."</a>";
|
||||
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Edit this blog entry."));
|
||||
}
|
||||
else {
|
||||
$links[] = "<a href=\"module.php?mod=blog&op=view&id=$node->uid\" title=\"". strtr(t("Read %u's latest blog entries."), array("%u" => $node->name)) ."\">". strtr(t("%u's blog"), array("%u" => $node->name)) ."</a>";
|
||||
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), t("Read %u's latest blog entries.", array("%u" => $node->name)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,15 +315,15 @@ function blog_block() {
|
|||
$result = db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
|
||||
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n";
|
||||
$output .= l(check_output($node->title), array("id" => $node->nid))."<br />\n";
|
||||
}
|
||||
|
||||
$output .= "<br /><div align=\"right\"><a href=\"module.php?mod=blog\" title=\"". t("Read the latest blog entries.") ."\">". t("more") ."</a></div>";
|
||||
$output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
|
||||
|
||||
$block[0]["subject"] = t("User blogs");
|
||||
$block[0]["content"] = $output;
|
||||
$block[0]["info"] = t("User blogs");
|
||||
$block[0]["link"] = "module.php?mod=blog";
|
||||
$block[0]["link"] = drupal_url(array("mod" => "blog"), "module");
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ function blog_access($op, $node) {
|
|||
}
|
||||
|
||||
function blog_save($op, $node) {
|
||||
global $REQUEST_URI;
|
||||
|
||||
if ($op == "approve") {
|
||||
return array("promote" => 1);
|
||||
}
|
||||
|
@ -102,13 +100,13 @@ function blog_feed_user($uid = 0, $date = 0) {
|
|||
|
||||
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '$uid' AND n.created > '". ($date - 2592000) ."' ORDER BY n.nid DESC LIMIT 15");
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->teaser);
|
||||
$items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser);
|
||||
}
|
||||
|
||||
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
||||
// $output .= "<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC \"-//W3C//ENTITIES Latin 1 for XHTML//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent\">\n";
|
||||
$output .= "<rss version=\"0.91\">\n";
|
||||
$output .= format_rss_channel("$account->name's blog", path_uri() ."module.php?mod=blog&op=view&id=$account->uid", "$account->name's blog", $items);
|
||||
$output .= format_rss_channel("$account->name's blog", path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => $account->uid), "module"), "$account->name's blog", $items);
|
||||
$output .= "</rss>\n";
|
||||
|
||||
header("Content-Type: text/xml");
|
||||
|
@ -121,12 +119,12 @@ function blog_feed_last() {
|
|||
$result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 15");
|
||||
|
||||
while ($blog = db_fetch_object($result)) {
|
||||
$items .= format_rss_item($blog->title, path_uri() ."node.php?id=$blog->nid", $blog->teaser);
|
||||
$items .= format_rss_item($blog->title, path_uri() . drupal_url(array("id" => $blog->nid)), $blog->teaser);
|
||||
}
|
||||
|
||||
$output .= "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
|
||||
$output .= "<rss version=\"0.91\">\n";
|
||||
$output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() ."module.php?mod=blog", "Recently updated blogs.", $items);
|
||||
$output .= format_rss_channel(variable_get("site_name", "drupal") .": user blogs", path_uri() . drupal_url(array("mod" => "blog"), "module"), "Recently updated blogs.", $items);
|
||||
$output .= "</rss>\n";
|
||||
|
||||
header("Content-Type: text/xml");
|
||||
|
@ -159,7 +157,7 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
|
|||
|
||||
if ($date != date("dny", $blog->created)) {
|
||||
$date = date("dny", $blog->created);
|
||||
$output .= "<tr><td colspan=\"2\"><b><a href=\"module.php?mod=blog&id=$blog->uid&date=". mktime(23, 59, 59, date("n", $blog->created), date("d", $blog->created), date("Y", $blog->created)) ."\" title=\"". t("Permanent link to this blog entry.") ."\">". format_date($blog->created, custom, "d M Y") .":</a></b></td></tr>";
|
||||
$output .= "<tr><td colspan=\"2\"><b>".lm(format_date($blog->created, custom, "d M Y"), array("mod" => "blog", "id" => $blog->uid, "date" => mktime(23, 59, 59, date("n", $blog->created), date("d", $blog->created), date("Y", $blog->created))), t("Permanent link to this blog entry."))."</b></td></tr>";
|
||||
}
|
||||
|
||||
$links = link_node($blog, 1);
|
||||
|
@ -170,15 +168,15 @@ function blog_page_user($uid = 0, $date = 0, $all = 0) {
|
|||
}
|
||||
|
||||
$output .= "</table>";
|
||||
$output .= "<a href=\"module.php?mod=blog&op=feed&id=$account->uid\" title=\"". t("Read the XML version of this page.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed", "id" => $account->uid), t("Read the XML version of this page."))."\n";
|
||||
if (!$all) {
|
||||
$output .= "<a href=\"module.php?mod=blog&op=view&id=$account->uid&all=1\" title=\"". t("Show all blogs by this user") ."\">". t("show all blogs") ."</a>";
|
||||
$output .= lm(t("show all blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid, "all" => 1), t("Show all blogs by this user"));
|
||||
}
|
||||
else {
|
||||
$output .= "<a href=\"module.php?mod=blog&op=view&id=$account->uid\" title=\"". t("Show recent blogs by this user") ."\">". t("show recent blogs") ."</a>";
|
||||
$output .= lm(t("show recent blogs"), array("mod" => "blog", "op" => "view", "id" => $account->uid), t("Show recent blogs by this user"));
|
||||
}
|
||||
|
||||
$theme->box(strtr(t("%u's blog"), array("%u" => $account->name)), $output);
|
||||
$theme->box(t("%u's blog", array("%u" => $account->name)), $output);
|
||||
}
|
||||
|
||||
function blog_page_last() {
|
||||
|
@ -199,7 +197,7 @@ function blog_page_last() {
|
|||
}
|
||||
|
||||
$output .= "</table>";
|
||||
$output .= "<a href=\"module.php?mod=blog&op=feed\" title=\"". t("Read the XML version of this page.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a>\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "blog", "op" => "feed"), t("Read the XML version of this page."))."\n";
|
||||
|
||||
$theme->box(t("User blogs"), $output, "main");
|
||||
}
|
||||
|
@ -231,10 +229,10 @@ function blog_form(&$node, &$help, &$error) {
|
|||
*/
|
||||
|
||||
if ($nid && $blog = node_load(array("nid" => $nid))) {
|
||||
$node->body = "<i>". $blog->body ."</i> [<a href=\"module.php?mod=blog&id=$blog->uid&date=$blog->created\">$blog->name</a>]";
|
||||
$node->body = "<i>". $blog->body ."</i> [".lm($blog->name, array("mod" => "blog", "id" => $blog->uid, "date" => $blog->created))."]";
|
||||
}
|
||||
|
||||
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '". check_input($iid) ."' AND i.fid = f.fid"))) {
|
||||
if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '%s' AND i.fid = f.fid", $iid))) {
|
||||
$node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n";
|
||||
}
|
||||
}
|
||||
|
@ -287,24 +285,24 @@ function blog_link($type, $node = 0, $main) {
|
|||
global $user;
|
||||
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=blog\" title=\"". t("Read the latest blog entries.") ."\">". t("user blogs") ."</a>";
|
||||
$links[] = lm(t("user blogs"), array("mod" => "blog"), t("Read the latest blog entries."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Add a new personal blog entry.") ."\">". t("create blog entry") ."</a>";
|
||||
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), t("Add a new personal blog entry."));
|
||||
}
|
||||
|
||||
if ($type == "menu.view" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=blog&op=view&id=$user->uid\" title=\"". t("Read your latest blog entries.") ."\">". t("view personal blog") ."</a>";
|
||||
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), t("Read your latest blog entries."));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->type == "blog") {
|
||||
global $op;
|
||||
if (blog_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Edit this blog entry.") ."\">". t("edit this blog") ."</a>";
|
||||
$links[] = lm(t("edit this blog"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Edit this blog entry."));
|
||||
}
|
||||
else {
|
||||
$links[] = "<a href=\"module.php?mod=blog&op=view&id=$node->uid\" title=\"". strtr(t("Read %u's latest blog entries."), array("%u" => $node->name)) ."\">". strtr(t("%u's blog"), array("%u" => $node->name)) ."</a>";
|
||||
$links[] = lm(t("%u's blog", array("%u" => $node->name)), array("mod" => "blog", "op" => "view", "id" => $node->uid), t("Read %u's latest blog entries.", array("%u" => $node->name)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,15 +315,15 @@ function blog_block() {
|
|||
$result = db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' ORDER BY n.nid DESC LIMIT 10");
|
||||
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$output .= "<a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br />\n";
|
||||
$output .= l(check_output($node->title), array("id" => $node->nid))."<br />\n";
|
||||
}
|
||||
|
||||
$output .= "<br /><div align=\"right\"><a href=\"module.php?mod=blog\" title=\"". t("Read the latest blog entries.") ."\">". t("more") ."</a></div>";
|
||||
$output .= "<br /><div align=\"right\">".lm(t("more"), array("mod" => "blog"), t("Read the latest blog entries."))."</div>";
|
||||
|
||||
$block[0]["subject"] = t("User blogs");
|
||||
$block[0]["content"] = $output;
|
||||
$block[0]["info"] = t("User blogs");
|
||||
$block[0]["link"] = "module.php?mod=blog";
|
||||
$block[0]["link"] = drupal_url(array("mod" => "blog"), "module");
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ function bloggerapi_user_blogs() {
|
|||
global $user;
|
||||
|
||||
if ($user->uid) {
|
||||
$struct = new xmlrpcval(array("url" => new xmlrpcval(path_uri() . "module.php?mod=blog&op=view&id=". urlencode($user->uid)),
|
||||
$struct = new xmlrpcval(array("url" => new xmlrpcval(path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => urlencode($user->uid)), "module")),
|
||||
"blogid" => new xmlrpcval($user->uid),
|
||||
"blogName" => new xmlrpcval($user->name . "'s blog at ". variable_get("site_name", "drupal"))
|
||||
),"struct");
|
||||
|
@ -237,7 +237,7 @@ function bloggerapi_user_info() {
|
|||
if ($user->uid) {
|
||||
return new xmlrpcval(array("nickname" => new xmlrpcval($user->name, "string"),
|
||||
"userid" => new xmlrpcval($user->id, "string"),
|
||||
"url" => new xmlrpcval(path_uri() . "module.php?mod=blog&op=view&id=". urlencode($user->uid), "string"),
|
||||
"url" => new xmlrpcval(path_uri() . drupal_url(array("mod" => "blog", "op" => "view", "id" => urlencode($user->uid)), "module"), "string"),
|
||||
"email" => new xmlrpcval($user->mail, "string"),
|
||||
"lastname" => new xmlrpcval(substr($user->name, strrpos($user->name," ")+1), "string"),
|
||||
"firstname" => new xmlrpcval(substr($user->name, 0, strrpos($user->name," ")), "string"),
|
||||
|
@ -375,7 +375,7 @@ function bloggerapi_help() {
|
|||
<p><a href="http://www.blogger.com">Blogger</a>, the well-known public
|
||||
weblog service, provides an application programing interface (API) to
|
||||
allow remote procedure calls (RPC) to the Blogger service. Drupal supports this <a href="http://plant.blogger.com/api/index.html">Blogger API</a>, which means that many remote clients (e.g. <a href="radio.userland.com">Radio</a>, <a href="http://simon.kittle.info/textrouter">TextRouter</a>, <a href="http://blogbuddy.sourceforge.net/">Blogbuddy</a>, <a href="http://www.bloggar.cjb.net/">Bloggar</a>,<a href="http://www.tswoam.co.uk/index.php?n_go=16">PerlyBlog</a>), may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>™.
|
||||
<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <a hr ef="/module.php?mod=user&op=help">Distributed Authentication</a> requests)</p>
|
||||
<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <? echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p>
|
||||
|
||||
<h3>Drupal Implementation </h3>
|
||||
|
||||
|
|
|
@ -92,30 +92,30 @@ function book_save($op, $node) {
|
|||
|
||||
function book_link($type, $node = 0, $main = 0) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to the collaborative books.") ."\">". t("collaborative book") ."</a>";
|
||||
$links[] = lm(t("collaborative book"), array("mod" => "book"), t("Read and contribute to the collaborative books."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=book\" title=\"". t("Add a new book page.") ."\">". t("create book page") ."</a>";
|
||||
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), t("Add a new book page."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=book\">". t("collaborative book") ."</a>";
|
||||
$links[] = la(t("collaborative book"), array("mod" => "book"));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Suggest an update for this book page.") ."\">". t("edit this page") ."</a>";
|
||||
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Suggest an update for this book page."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
function book_load($node) {
|
||||
global $user, $REQUEST_URI;
|
||||
global $user;
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '$node->nid'"));
|
||||
|
||||
if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) {
|
||||
if (strstr(request_uri(), drupal_url(array("mod" => "node", "op" => "edit"), "module"))) {
|
||||
|
||||
/*
|
||||
** If a user is about to update a book page, we overload some
|
||||
|
@ -219,12 +219,12 @@ function book_node_link($node = 0) {
|
|||
}
|
||||
|
||||
if ($op == t("Add to book outline")) {
|
||||
db_query("INSERT INTO book (nid, parent, weight) VALUES ('$node->nid', '". check_query($edit["parent"]) ."', '". check_query($edit["weight"]) ."')");
|
||||
db_query("INSERT INTO book (nid, parent, weight) VALUES ('$node->nid', '%s', '%s')", $edit["parent"], $edit["weight"]);
|
||||
$output .= status(t("added the node to the book."));
|
||||
}
|
||||
|
||||
if ($op == t("Update book outline")) {
|
||||
db_query("UPDATE book SET parent = '". check_query($edit["parent"]) ."', weight = '". check_query($edit["weight"]) ."' WHERE nid = '$node->nid'");
|
||||
db_query("UPDATE book SET parent = '%s', weight = '%s' WHERE nid = '$node->nid'", $edit["parent"], $edit["weight"]);
|
||||
$output .= status(t("updated the book outline."));
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ function book_node_link($node = 0) {
|
|||
|
||||
$output .= form_hidden("nid", $node->nid);
|
||||
|
||||
return form($output, "post", "admin.php?mod=book&op=outline");
|
||||
return form($output, "post", drupal_url(array("mod" => "book", "op" => "outline"), "admin"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,13 +384,13 @@ function book_view($node, $main = 0) {
|
|||
|
||||
if ($node->title) {
|
||||
foreach (book_location($node) as $level) {
|
||||
$location .= "$indent <a href=\"node.php?id=$level->nid\">$level->title</a><br />";
|
||||
$location .= "$indent ".l($level->title, array("id" => $level->nid))."<br />";
|
||||
$indent .= "-";
|
||||
}
|
||||
|
||||
$output .= " <tr><td colspan=\"3\">$location</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><b><big>". check_output($node->title) ."</big></b>". ($node->body ? "<br /><small><i>". strtr(t("Last updated by %u on %d"), array("%u" => format_name($node), "%d" => format_date($node->created))) ."</i></small> " : "") ."</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><b><big>". check_output($node->title) ."</big></b>". ($node->body ? "<br /><small><i>". t("Last updated by %u on %d", array("%u" => format_name($node), "%d" => format_date($node->created))) ."</i></small> " : "") ."</td></tr>";
|
||||
}
|
||||
|
||||
if ($node->body) {
|
||||
|
@ -406,8 +406,8 @@ function book_view($node, $main = 0) {
|
|||
}
|
||||
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<a href=\"node.php?id=$prev->nid\" title=\"". t("View the previous page in this book.") ."\">". t("previous") ."</a>" : t("previous")) ."</td><td align=\"center\" width=\"34%\"><a href=\"module.php?mod=book\" title=\"". t("View this book's table of contents.") ."\">index</a></td><td align=\"right\" width=\"33%\">". ($next ? "<a href=\"node.php?id=$next->nid\" title=\"". t("View the next page in this book.") ."\">". t("next") ."</a>" : t("next")) ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : " ") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? "<a href=\"node.php?id=$node->parent\" title=\"". t("View this page's parent section.") ."\">". t("up") ."</a>" : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : " ") ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), t("View the previous page in this book.")) : t("previous")) ."</td><td align=\"center\" width=\"34%\">".lm(t("index"), array("mod" => "book"), t("View this book's table of contents."))."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), t("View the next page in this book.")) : t("next")) ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : " ") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), t("View this page's parent section.")) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : " ") ."</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\" align=\"right\"><div style=\"margin: 10 10 10 10;\">". $theme->links(link_node($node, $main)) ."</div></td></tr>";
|
||||
$output .= "</table>";
|
||||
|
@ -462,7 +462,7 @@ function book_tree_recurse($nid, $depth, $children) {
|
|||
if ($depth > 0) {
|
||||
if ($children[$nid]) {
|
||||
foreach ($children[$nid] as $foo => $node) {
|
||||
$output .= "<li><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></li>";
|
||||
$output .= "<li>".l(check_output($node->title), array("id" => $node->nid))."</li>";
|
||||
|
||||
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) {
|
||||
$output .= "<ul>$tree</ul>";
|
||||
|
@ -508,7 +508,7 @@ function book_render() {
|
|||
|
||||
if ($node) {
|
||||
// output the content:
|
||||
$output .= "<dt><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></dt><dd>". book_body($node) ."<br /><br /></dd>";
|
||||
$output .= "<dt>".l(check_output($node->title), array("id" => $node->nid))."</dt><dd>". book_body($node) ."<br /><br /></dd>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ function book_page() {
|
|||
}
|
||||
|
||||
function book_export_html($id = "", $depth = 1) {
|
||||
$result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '". check_input($id) ." AND (n.moderate = 0 OR n.revisions != '')'");
|
||||
$result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%s' AND (n.moderate = 0 OR n.revisions != '')", $id);
|
||||
|
||||
while ($page = db_fetch_object($result)) {
|
||||
// load the node:
|
||||
|
@ -608,12 +608,12 @@ function book_admin_view_line($node, $depth = 0) {
|
|||
*/
|
||||
|
||||
$output .= "<tr>";
|
||||
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\"><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></div></td>";
|
||||
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">".l(check_output($node->title), array("id" => $node->nid))."</div></td>";
|
||||
$output .= " <td align=\"center\">$revision</td>";
|
||||
$output .= " <td><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit node") ."</td>";
|
||||
$output .= " <td>".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td>";
|
||||
//TODO: get this link to work. Must pass $nid along so it is received by book_node_link()
|
||||
//$output .= " <td><a href=\"admin.php?mod=book&nid=$node->nid&op=Edit+book+outline\">". t("edit book outline") ."</td>";
|
||||
$output .= " <td><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete node") ."</td>";
|
||||
//$output .= " <td>".la(t("edit book outline"), array("mod" => "book", "nid" => $node->nid, "op" => "Edit+book+outline"))."</td>";
|
||||
$output .= " <td>".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td>";
|
||||
$output .= "</tr>";
|
||||
|
||||
return $output;
|
||||
|
@ -660,7 +660,7 @@ function book_admin_orphan() {
|
|||
$output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>";
|
||||
foreach ($pages as $nid => $node) {
|
||||
if ($node->parent && empty($pages[$node->parent])) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></td><td><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit page") ."</td><td><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete page") ."</td>";
|
||||
$output .= "<tr><td>".l(check_output($node->title), array("id" => $node->nid))."</td><td>".la(t("edit page"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td><td>".la(t("delete page"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td>";
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
@ -672,11 +672,11 @@ function book_admin_links() {
|
|||
$result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title");
|
||||
|
||||
while ($book = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=view&id=$book->nid\">". t("book") .": <i>". check_output($book->title) ."</i></a>";
|
||||
$links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid));
|
||||
}
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=orphan\">". t("orphan pages") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=book&op=feed\" title=\"" . t("display all books in a single HTML page") . ".\">" . t("export to HTML") . "</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=help\">" . t("help") . "</a>";
|
||||
$links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan"));
|
||||
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), t("display all books in a single HTML page"));
|
||||
$links[] = la(t("help"), array("mod" => "book", "op" => "help"));
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ function book_help() {
|
|||
|
||||
<p>The Collaborative Book is a magnificient mechanism for organizing content authored by many users.
|
||||
You may use it to organize a Manual (e.g. <a href="http://www.drupal.org">Drupal Handbook</a>),
|
||||
to <a href="#faq">maintain an FAQ</a>, or to manage any outline-like content. Books can have
|
||||
to <a href="#faq">maintain a FAQ</a>, or to manage any outline-like content. Books can have
|
||||
Chapters, Sections, etc. In fact, books can have an arbitrarily deep nesting strucuture.</p>
|
||||
|
||||
<p>Under the covers, a Book is only an organization of nodes. These nodes are often of type <i>book page</i>,
|
||||
|
@ -735,17 +735,15 @@ page is usually stored as a new revision of a node. This capability makes it eas
|
|||
should that become desirable.</p>
|
||||
|
||||
<p>Like other node types, Book submissions and edits may be subject to moderation, depending on your configuration.
|
||||
Similarly, Books use <a href="/admin.php?mod=user&op=permission">permissions</a> to determine who may
|
||||
Similarly, Books use <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may
|
||||
read and write to them. Only Administrators are allowed to create new books, which are really just nodes whose
|
||||
Parent is <i><root></i>. To include an existing node in your book, click on the Administer link in that node.
|
||||
At the bottom of this Admin page, click on the <i>Edit Book Outline</i> button. This enables you to place the node
|
||||
wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
|
||||
|
||||
<p>Administrators may review the hierarchy of their books by clicking on the <a href="/admin.php?mod=book">Collaborative Book link</a>
|
||||
in the Admin center. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a Parent node is deleted, he may leave behind child nodes.
|
||||
These nodes are now <i>orphans</i>. Administrators should periodically <a href="/admin.php?mod=book&op=orphan">
|
||||
review their books for orphans</a> and reaffiliate those pages as desired. Finally, administrators may also
|
||||
<a href="/admin.php?mod=book&op=feed">export their books</a> to a single, flat HTML page which is suitable for printing.</p>
|
||||
<p>Administrators may review the hierarchy of their books by clicking on the <? echo la("Collaborative Book link", array("mod" => "book")) ?> in the Admin center. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a Parent node is deleted, he may leave behind child nodes.
|
||||
These nodes are now <i>orphans</i>. Administrators should periodically <? echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
|
||||
<? echo la("export their books", array("mod" => "book", "op" => "feed")) ?> to a single, flat HTML page which is suitable for printing.</p>
|
||||
|
||||
<a name="faq"></a><h3>Maintain an FAQ with <i>Collaborative Book</i></h3>
|
||||
|
||||
|
@ -788,8 +786,7 @@ seek.
|
|||
you are creating a post solely for inclusion in your book, then use the
|
||||
<i>Create book page</i> link.</li>
|
||||
<li>If you don't see the <i>administer</i> link, then you probably have
|
||||
insufficient <a
|
||||
href="/admin.php?mod=user&op=permission">permissions</a>.</li>
|
||||
insufficient <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
|
||||
<li>If you want to get really fancy, note that Books are one of the few
|
||||
content types which allow raw PHP in their <i>body</i>. So you've got lots of
|
||||
geeky possibilities there.</li>
|
||||
|
|
|
@ -92,30 +92,30 @@ function book_save($op, $node) {
|
|||
|
||||
function book_link($type, $node = 0, $main = 0) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to the collaborative books.") ."\">". t("collaborative book") ."</a>";
|
||||
$links[] = lm(t("collaborative book"), array("mod" => "book"), t("Read and contribute to the collaborative books."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=book\" title=\"". t("Add a new book page.") ."\">". t("create book page") ."</a>";
|
||||
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), t("Add a new book page."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=book\">". t("collaborative book") ."</a>";
|
||||
$links[] = la(t("collaborative book"), array("mod" => "book"));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->type == "book" && book_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Suggest an update for this book page.") ."\">". t("edit this page") ."</a>";
|
||||
$links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Suggest an update for this book page."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
function book_load($node) {
|
||||
global $user, $REQUEST_URI;
|
||||
global $user;
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT format, parent, weight, log FROM book WHERE nid = '$node->nid'"));
|
||||
|
||||
if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) {
|
||||
if (strstr(request_uri(), drupal_url(array("mod" => "node", "op" => "edit"), "module"))) {
|
||||
|
||||
/*
|
||||
** If a user is about to update a book page, we overload some
|
||||
|
@ -219,12 +219,12 @@ function book_node_link($node = 0) {
|
|||
}
|
||||
|
||||
if ($op == t("Add to book outline")) {
|
||||
db_query("INSERT INTO book (nid, parent, weight) VALUES ('$node->nid', '". check_query($edit["parent"]) ."', '". check_query($edit["weight"]) ."')");
|
||||
db_query("INSERT INTO book (nid, parent, weight) VALUES ('$node->nid', '%s', '%s')", $edit["parent"], $edit["weight"]);
|
||||
$output .= status(t("added the node to the book."));
|
||||
}
|
||||
|
||||
if ($op == t("Update book outline")) {
|
||||
db_query("UPDATE book SET parent = '". check_query($edit["parent"]) ."', weight = '". check_query($edit["weight"]) ."' WHERE nid = '$node->nid'");
|
||||
db_query("UPDATE book SET parent = '%s', weight = '%s' WHERE nid = '$node->nid'", $edit["parent"], $edit["weight"]);
|
||||
$output .= status(t("updated the book outline."));
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ function book_node_link($node = 0) {
|
|||
|
||||
$output .= form_hidden("nid", $node->nid);
|
||||
|
||||
return form($output, "post", "admin.php?mod=book&op=outline");
|
||||
return form($output, "post", drupal_url(array("mod" => "book", "op" => "outline"), "admin"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,13 +384,13 @@ function book_view($node, $main = 0) {
|
|||
|
||||
if ($node->title) {
|
||||
foreach (book_location($node) as $level) {
|
||||
$location .= "$indent <a href=\"node.php?id=$level->nid\">$level->title</a><br />";
|
||||
$location .= "$indent ".l($level->title, array("id" => $level->nid))."<br />";
|
||||
$indent .= "-";
|
||||
}
|
||||
|
||||
$output .= " <tr><td colspan=\"3\">$location</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><b><big>". check_output($node->title) ."</big></b>". ($node->body ? "<br /><small><i>". strtr(t("Last updated by %u on %d"), array("%u" => format_name($node), "%d" => format_date($node->created))) ."</i></small> " : "") ."</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><b><big>". check_output($node->title) ."</big></b>". ($node->body ? "<br /><small><i>". t("Last updated by %u on %d", array("%u" => format_name($node), "%d" => format_date($node->created))) ."</i></small> " : "") ."</td></tr>";
|
||||
}
|
||||
|
||||
if ($node->body) {
|
||||
|
@ -406,8 +406,8 @@ function book_view($node, $main = 0) {
|
|||
}
|
||||
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<a href=\"node.php?id=$prev->nid\" title=\"". t("View the previous page in this book.") ."\">". t("previous") ."</a>" : t("previous")) ."</td><td align=\"center\" width=\"34%\"><a href=\"module.php?mod=book\" title=\"". t("View this book's table of contents.") ."\">index</a></td><td align=\"right\" width=\"33%\">". ($next ? "<a href=\"node.php?id=$next->nid\" title=\"". t("View the next page in this book.") ."\">". t("next") ."</a>" : t("next")) ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : " ") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? "<a href=\"node.php?id=$node->parent\" title=\"". t("View this page's parent section.") ."\">". t("up") ."</a>" : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : " ") ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? l(t("previous"), array("id" => $prev->nid), t("View the previous page in this book.")) : t("previous")) ."</td><td align=\"center\" width=\"34%\">".lm(t("index"), array("mod" => "book"), t("View this book's table of contents."))."</td><td align=\"right\" width=\"33%\">". ($next ? l(t("next"), array("id" => $next->nid), t("View the next page in this book.")) : t("next")) ."</td></tr>";
|
||||
$output .= " <tr><td align=\"left\" width=\"33%\">". ($prev ? "<small>". check_output($prev->title) ."</small>" : " ") ."</td><td align=\"center\" width=\"34%\">". ($node->parent ? l(t("up"), array("id" => $node->parent), t("View this page's parent section.")) : t("up")) ."</td><td align=\"right\" width=\"33%\">". ($next ? "<small>". check_output($next->title) ."</small>" : " ") ."</td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\"><hr /></td></tr>";
|
||||
$output .= " <tr><td colspan=\"3\" align=\"right\"><div style=\"margin: 10 10 10 10;\">". $theme->links(link_node($node, $main)) ."</div></td></tr>";
|
||||
$output .= "</table>";
|
||||
|
@ -462,7 +462,7 @@ function book_tree_recurse($nid, $depth, $children) {
|
|||
if ($depth > 0) {
|
||||
if ($children[$nid]) {
|
||||
foreach ($children[$nid] as $foo => $node) {
|
||||
$output .= "<li><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></li>";
|
||||
$output .= "<li>".l(check_output($node->title), array("id" => $node->nid))."</li>";
|
||||
|
||||
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) {
|
||||
$output .= "<ul>$tree</ul>";
|
||||
|
@ -508,7 +508,7 @@ function book_render() {
|
|||
|
||||
if ($node) {
|
||||
// output the content:
|
||||
$output .= "<dt><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></dt><dd>". book_body($node) ."<br /><br /></dd>";
|
||||
$output .= "<dt>".l(check_output($node->title), array("id" => $node->nid))."</dt><dd>". book_body($node) ."<br /><br /></dd>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ function book_page() {
|
|||
}
|
||||
|
||||
function book_export_html($id = "", $depth = 1) {
|
||||
$result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '". check_input($id) ." AND (n.moderate = 0 OR n.revisions != '')'");
|
||||
$result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%s' AND (n.moderate = 0 OR n.revisions != '')", $id);
|
||||
|
||||
while ($page = db_fetch_object($result)) {
|
||||
// load the node:
|
||||
|
@ -608,12 +608,12 @@ function book_admin_view_line($node, $depth = 0) {
|
|||
*/
|
||||
|
||||
$output .= "<tr>";
|
||||
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\"><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></div></td>";
|
||||
$output .= " <td><div style=\"padding-left: ". (25 * $depth) ."px;\">".l(check_output($node->title), array("id" => $node->nid))."</div></td>";
|
||||
$output .= " <td align=\"center\">$revision</td>";
|
||||
$output .= " <td><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit node") ."</td>";
|
||||
$output .= " <td>".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td>";
|
||||
//TODO: get this link to work. Must pass $nid along so it is received by book_node_link()
|
||||
//$output .= " <td><a href=\"admin.php?mod=book&nid=$node->nid&op=Edit+book+outline\">". t("edit book outline") ."</td>";
|
||||
$output .= " <td><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete node") ."</td>";
|
||||
//$output .= " <td>".la(t("edit book outline"), array("mod" => "book", "nid" => $node->nid, "op" => "Edit+book+outline"))."</td>";
|
||||
$output .= " <td>".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td>";
|
||||
$output .= "</tr>";
|
||||
|
||||
return $output;
|
||||
|
@ -660,7 +660,7 @@ function book_admin_orphan() {
|
|||
$output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>";
|
||||
foreach ($pages as $nid => $node) {
|
||||
if ($node->parent && empty($pages[$node->parent])) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></td><td><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit page") ."</td><td><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete page") ."</td>";
|
||||
$output .= "<tr><td>".l(check_output($node->title), array("id" => $node->nid))."</td><td>".la(t("edit page"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td><td>".la(t("delete page"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td>";
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
@ -672,11 +672,11 @@ function book_admin_links() {
|
|||
$result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title");
|
||||
|
||||
while ($book = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=view&id=$book->nid\">". t("book") .": <i>". check_output($book->title) ."</i></a>";
|
||||
$links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid));
|
||||
}
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=orphan\">". t("orphan pages") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=book&op=feed\" title=\"" . t("display all books in a single HTML page") . ".\">" . t("export to HTML") . "</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=book&op=help\">" . t("help") . "</a>";
|
||||
$links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan"));
|
||||
$links[] = lm(t("export to HTML"), array("mod" => "book", "op" => "feed"), t("display all books in a single HTML page"));
|
||||
$links[] = la(t("help"), array("mod" => "book", "op" => "help"));
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ function book_help() {
|
|||
|
||||
<p>The Collaborative Book is a magnificient mechanism for organizing content authored by many users.
|
||||
You may use it to organize a Manual (e.g. <a href="http://www.drupal.org">Drupal Handbook</a>),
|
||||
to <a href="#faq">maintain an FAQ</a>, or to manage any outline-like content. Books can have
|
||||
to <a href="#faq">maintain a FAQ</a>, or to manage any outline-like content. Books can have
|
||||
Chapters, Sections, etc. In fact, books can have an arbitrarily deep nesting strucuture.</p>
|
||||
|
||||
<p>Under the covers, a Book is only an organization of nodes. These nodes are often of type <i>book page</i>,
|
||||
|
@ -735,17 +735,15 @@ page is usually stored as a new revision of a node. This capability makes it eas
|
|||
should that become desirable.</p>
|
||||
|
||||
<p>Like other node types, Book submissions and edits may be subject to moderation, depending on your configuration.
|
||||
Similarly, Books use <a href="/admin.php?mod=user&op=permission">permissions</a> to determine who may
|
||||
Similarly, Books use <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may
|
||||
read and write to them. Only Administrators are allowed to create new books, which are really just nodes whose
|
||||
Parent is <i><root></i>. To include an existing node in your book, click on the Administer link in that node.
|
||||
At the bottom of this Admin page, click on the <i>Edit Book Outline</i> button. This enables you to place the node
|
||||
wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
|
||||
|
||||
<p>Administrators may review the hierarchy of their books by clicking on the <a href="/admin.php?mod=book">Collaborative Book link</a>
|
||||
in the Admin center. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a Parent node is deleted, he may leave behind child nodes.
|
||||
These nodes are now <i>orphans</i>. Administrators should periodically <a href="/admin.php?mod=book&op=orphan">
|
||||
review their books for orphans</a> and reaffiliate those pages as desired. Finally, administrators may also
|
||||
<a href="/admin.php?mod=book&op=feed">export their books</a> to a single, flat HTML page which is suitable for printing.</p>
|
||||
<p>Administrators may review the hierarchy of their books by clicking on the <? echo la("Collaborative Book link", array("mod" => "book")) ?> in the Admin center. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a Parent node is deleted, he may leave behind child nodes.
|
||||
These nodes are now <i>orphans</i>. Administrators should periodically <? echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
|
||||
<? echo la("export their books", array("mod" => "book", "op" => "feed")) ?> to a single, flat HTML page which is suitable for printing.</p>
|
||||
|
||||
<a name="faq"></a><h3>Maintain an FAQ with <i>Collaborative Book</i></h3>
|
||||
|
||||
|
@ -788,8 +786,7 @@ seek.
|
|||
you are creating a post solely for inclusion in your book, then use the
|
||||
<i>Create book page</i> link.</li>
|
||||
<li>If you don't see the <i>administer</i> link, then you probably have
|
||||
insufficient <a
|
||||
href="/admin.php?mod=user&op=permission">permissions</a>.</li>
|
||||
insufficient <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
|
||||
<li>If you want to get really fancy, note that Books are one of the few
|
||||
content types which allow raw PHP in their <i>body</i>. So you've got lots of
|
||||
geeky possibilities there.</li>
|
||||
|
|
|
@ -32,7 +32,7 @@ function box_help() {
|
|||
|
||||
function box_link($type) {
|
||||
if ($type == "admin" && user_access("administer blocks")) {
|
||||
$links[] = "<a href=\"admin.php?mod=box\">boxes</a>";
|
||||
$links[] = la(t("boxes"), array("mod" => "box"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -51,7 +51,7 @@ function box_block() {
|
|||
}
|
||||
|
||||
function box_get_array($bid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '". check_input($bid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM boxes WHERE bid = '%s'", $bid));
|
||||
}
|
||||
|
||||
function box_display() {
|
||||
|
@ -65,7 +65,7 @@ function box_display() {
|
|||
$output .= " <TR><TH>Body:</TH><TD>". nl2br(htmlentities($block->body)) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Type:</TH><TD>". $type[$block->type] ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Description:</TH><TD>". check_output($block->info) ."</TD></TR>\n";
|
||||
$output .= " <TR><TH>Operations:</TH><TD><A HREF=\"admin.php?mod=box&op=edit&id=$block->bid\">edit</A></TD></TR>\n";
|
||||
$output .= " <TR><TH>Operations:</TH><TD>".la(t("edit"), array("mod" => "box", "op" => "edit", "id" => $block->bid))."</TD></TR>\n";
|
||||
$output .= "</TABLE>\n";
|
||||
$output .= "<BR><BR>\n";
|
||||
}
|
||||
|
@ -75,13 +75,13 @@ function box_display() {
|
|||
|
||||
function box_save($edit) {
|
||||
if ($edit[bid] && $edit[title]) {
|
||||
db_query("UPDATE boxes SET title = '". check_input($edit[title]) ."', body = '". check_input($edit[body]) ."', info = '". check_input($edit[info]) ."', type = '". check_input($edit[type]) ."' WHERE bid = '". check_input($edit[bid]) ."'");
|
||||
db_query("UPDATE boxes SET title = '%s', body = '%s', info = '%s', type = '%s' WHERE bid = '%s'", $edit[title], $edit[body], $edit[info], $edit[type], $edit[bid]);
|
||||
}
|
||||
else if ($edit[bid]) {
|
||||
db_query("DELETE FROM boxes WHERE bid = '". check_input($edit[bid]) ."'");
|
||||
db_query("DELETE FROM boxes WHERE bid = '%s'", $edit[bid]);
|
||||
}
|
||||
else {
|
||||
db_query("INSERT INTO boxes (title, body, info, type) VALUES ('". check_input($edit[title]) ."', '". check_input($edit[body]) ."', '". check_input($edit[info]) ."', '". check_input($edit[type]) ."')");
|
||||
db_query("INSERT INTO boxes (title, body, info, type) VALUES ('%s', '%s', '%s', '%s')", $edit[title], $edit[body], $edit[info], $edit[type]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ function box_admin() {
|
|||
|
||||
if (user_access("administer blocks")) {
|
||||
|
||||
print "<SMALL><A HREF=\"admin.php?mod=box&op=add\">add new box</A> | <A HREF=\"admin.php?mod=box\">overview</A> | <A HREF=\"admin.php?mod=box&op=help\">help</A></SMALL><HR>\n";
|
||||
print "<SMALL>".la(t("add new box"), array("mod" => "box", "op" => "add"))." | ".la(t("overview"), array("mod" => "box"))." | ".la(t("help"), array("mod" => "box", "op" => "help"))."</SMALL><HR>\n";
|
||||
|
||||
block_init();
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ function cloud_perm() {
|
|||
|
||||
function cloud_link($type) {
|
||||
if ($type == "page" && user_access("access site cloud")) {
|
||||
$links[] = "<a href=\"module.php?mod=cloud\" title=\"". t("Monitor other sites in the cloud.") ."\">". t("site cloud") ."</a>";
|
||||
$links[] = lm(t("site cloud"), array("mod" => "cloud"), t("Monitor other sites in the cloud."));;
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer site cloud")) {
|
||||
$links[] = "<a href=\"admin.php?mod=cloud\">". t("site cloud") ."</a>";
|
||||
$links[] = la(t("site cloud"), array("mod" => "cloud"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -65,7 +65,7 @@ function cloud_update($site) {
|
|||
}
|
||||
|
||||
if (abs($site["size"] - strlen($data)) > $site["threshold"]) {
|
||||
db_query("UPDATE site SET size = '". strlen($data) ."', timestamp = '". time() ."' WHERE link = '". check_input($site["link"]) ."'");
|
||||
db_query("UPDATE site SET size = '". strlen($data) ."', timestamp = '". time() ."' WHERE link = '%s'", $site["link"]);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
@ -97,18 +97,18 @@ function cloud_form($edit = array()) {
|
|||
}
|
||||
|
||||
function cloud_get_site($sid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM site WHERE sid = '". check_input($sid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM site WHERE sid = '%s'", $sid));
|
||||
}
|
||||
|
||||
function cloud_save($edit) {
|
||||
if ($edit["sid"] && $edit["name"]) {
|
||||
db_query("UPDATE site SET name = '". check_input($edit["name"]) ."', link = '". check_input($edit["link"]) ."', feed = '". check_input($edit["feed"]) ."', refresh = '". check_input($edit["refresh"]) ."', threshold = '". check_input($edit["threshold"]) ."' WHERE sid = '". check_input($edit["sid"]) ."'");
|
||||
db_query("UPDATE site SET name = '%s', link = '%s', feed = '%s', refresh = '%s', threshold = '%s' WHERE sid = '%s'", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"], $edit["sid"]);
|
||||
}
|
||||
else if ($edit["sid"]) {
|
||||
db_query("DELETE FROM site WHERE sid = '". check_input($edit["sid"]) ."'");
|
||||
db_query("DELETE FROM site WHERE sid = '%s'", $edit["sid"]);
|
||||
}
|
||||
else {
|
||||
db_query("INSERT INTO site (name, link, feed, refresh, threshold) VALUES ('". check_input($edit["name"]) ."', '". check_input($edit["link"]) ."', '". check_input($edit["feed"]) ."', '". check_input($edit["refresh"]) ."', '". check_input($edit["threshold"]) ."')");
|
||||
db_query("INSERT INTO site (name, link, feed, refresh, threshold) VALUES ('%s', '%s', '%s', '%s', '%s')", $edit["name"], $edit["link"], $edit["feed"], $edit["refresh"], $edit["threshold"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ function cloud_display() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>site</th><th>last update</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
while ($site = db_fetch_object($result)) {
|
||||
$output .= " <tr><td><a href=\"". check_output($site->link) ."\">". check_output($site->name) ."</a></td><td>". ($site->timestamp ? format_interval(time() - $site->timestamp) ." ago" : "never") ."</td><td><a href=\"admin.php?mod=cloud&op=edit&id=$site->sid\">edit site</a></td><td><a href=\"admin.php?mod=cloud&op=update&id=$site->sid\">update site</a></td></tr>\n";
|
||||
$output .= " <tr><td><a href=\"". check_output($site->link) ."\">". check_output($site->name) ."</a></td><td>". ($site->timestamp ? format_interval(time() - $site->timestamp) ." ago" : "never") ."</td><td>".la(t("edit site"), array("mod" => "cloud", "op" => "edit", "id" => $site->sid))."</td><td>".la(t("update site"), array("mod" => "cloud", "op" => "update", "id" => $site->sid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -138,11 +138,11 @@ function cloud_list($limit = 10) {
|
|||
if ($hour == 0) {
|
||||
$output .= "<br />". t("Updated < 1 hours ago:");
|
||||
} else {
|
||||
$output .= "<br />". strtr(t("Updated %a ago:"), array("%a" => format_plural($hour, "hour", "hours")));
|
||||
$output .= "<br />". t("Updated %a ago:", array("%a" => format_plural($hour, "hour", "hours")));
|
||||
}
|
||||
}
|
||||
else if ($list) {
|
||||
$output .= "<br />". strtr(t("Updated more than %a ago:"), array("%a" => format_plural($hour, "hour", "hours")));
|
||||
$output .= "<br />". t("Updated more than %a ago:", array("%a" => format_plural($hour, "hour", "hours")));
|
||||
$list = 0;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ function cloud_page() {
|
|||
|
||||
function cloud_block() {
|
||||
$block[0]["subject"] = t("Site cloud");
|
||||
$block[0]["content"] = cloud_list(20) . "<br /><div align=\"right\"><a href=\"module.php?mod=cloud\" title=\"". t("Monitor other sites in the cloud.") ."\">". t("more") ."</a></div>";
|
||||
$block[0]["content"] = cloud_list(20) . "<br /><div align=\"right\">".lm(t("more"), array("mod" => "cloud"), t("Monitor other sites in the cloud."))."</div>";
|
||||
$block[0]["info"] = t("Site cloud");
|
||||
return $block;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ function cloud_admin() {
|
|||
global $op, $id, $edit;
|
||||
|
||||
if (user_access("administer site cloud")) {
|
||||
print "<small><a href=\"admin.php?mod=cloud&op=add\">add new site</a> | <a href=\"admin.php?mod=cloud\">overview</a> | <a href=\"admin.php?mod=cloud&op=help\">help</a></small><hr />\n";
|
||||
print "<small>".la(t("add new site"), array("mod" => "cloud", "op" => "add"))." | ".la(t("overview"), array("mod" => "cloud"))." | ".la(t("help"), array("mod" => "cloud", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "add":
|
||||
|
|
|
@ -7,8 +7,8 @@ $GLOBALS["corder"] = array(1 => "Date - newest first", 2 => "Date - oldest first
|
|||
function comment_help() {
|
||||
$output .= "<p>The comment module enables users to submit posts that are directly associated with a piece of content. These associated posts are called <i>comments</i>. Comments may be <i>threaded</i>, which means that Drupal keeps track of multiple subconversations around a piece of content. Threading helps to keep the comment conversation more organized. Users are presented with several ways to view the comment conversation, and if desired, users may easily choose a <i>flat</i> presentation of comments instead of threaded. Further, users may choose to order their comments view by <i>newest first</i> or by <i>oldest first</i>. Finally, users may view a folded list or an expanded list of comments. Folded limits the comment display to <i>subject</i> only. Drupal remembers the comment view preference of each user whenever he changes a view setting.</p>";
|
||||
$output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>";
|
||||
$output .= "<p>Comments behave like other user submissions in Drupal. Specifically, <a href=\"admin.php?mod=system&type=filter\">filters</a> like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
|
||||
$output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the <a href=\"admin.php?mod=user&op=permission\"></a>user permissions</a> administration page. Additionally, administrators may edit or search through comments on the <a href=\"admin.php?mod=comment\">comments admininistration page<a>, as well as set the default display view for new users.</p>";
|
||||
$output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ".la("filters", array("mod" => "system", "type" => "filter"))." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
|
||||
$output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ".la("user permissions", array("mod" => "user", "op" => "permission"))." administration page. Additionally, administrators may edit or search through comments on the ".la("comments admininistration page", array("mod" => "comment")).", as well as set the default display view for new users.</p>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ function comment_num_new($nid) {
|
|||
** of new comments.
|
||||
*/
|
||||
|
||||
$history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '$nid'"));
|
||||
$comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE n.nid = '$nid' AND timestamp > '". ($history->timestamp ? $history->timestamp : 0) ."' GROUP BY n.nid"));
|
||||
$history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '%s'", $nid));
|
||||
$comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE n.nid = '%s' AND timestamp > '". ($history->timestamp ? $history->timestamp : 0) ."' GROUP BY n.nid", $nid));
|
||||
|
||||
return $comment->number ? $comment->number : 0;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ function comment_reply($pid, $nid) {
|
|||
$context->nid = $nid;
|
||||
if (user_access("access comments", $context)) {
|
||||
if ($pid) {
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$pid'"));
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%s'", $pid));
|
||||
comment_view($comment, t("reply to this comment"));
|
||||
}
|
||||
else {
|
||||
|
@ -201,7 +201,7 @@ function comment_preview($edit) {
|
|||
$theme->box(t("Reply"), comment_form($edit));
|
||||
|
||||
if ($edit["pid"]) {
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$edit[pid]'"));
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%s'", $edit[pid]));
|
||||
comment_view($comment, t("reply to this comment"));
|
||||
}
|
||||
else {
|
||||
|
@ -234,7 +234,7 @@ function comment_post($edit) {
|
|||
** validated/filtered data to perform such check.
|
||||
*/
|
||||
|
||||
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '". check_query($edit["pid"]) ."' AND nid = '". check_query($edit["nid"]) ."' AND subject = '". check_query($edit["subject"]) ."' AND comment = '". check_query($edit["comment"]) ."'"), 0);
|
||||
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '%s' AND nid = '%s' AND subject = '%s' AND comment = '%s'", $edit["pid"], $edit["nid"], $edit["subject"], $edit["comment"]), 0);
|
||||
|
||||
if ($duplicate != 0) {
|
||||
watchdog("warning", "comment: duplicate '". $edit["subject"] ."'");
|
||||
|
@ -249,7 +249,7 @@ function comment_post($edit) {
|
|||
** user.
|
||||
*/
|
||||
|
||||
db_query("UPDATE comments SET subject = '". check_query($edit["subject"]) ."', comment = '". check_query($edit["comment"]) ."' WHERE cid = '". check_query($edit["cid"]) ."' AND uid = '$user->uid'");
|
||||
db_query("UPDATE comments SET subject = '%s', comment = '%s' WHERE cid = '%s' AND uid = '$user->uid'", $edit["subject"], $edit["comment"], $edit["cid"]);
|
||||
|
||||
/*
|
||||
** Add entry to the watchdog log:
|
||||
|
@ -269,7 +269,7 @@ function comment_post($edit) {
|
|||
** Add the comment to database:
|
||||
*/
|
||||
|
||||
db_query("INSERT INTO comments (nid, pid, uid, subject, comment, hostname, timestamp) VALUES ('". check_query($edit["nid"]) ."', '". check_query($edit["pid"]) ."', '$user->uid', '". check_query($edit["subject"]) ."', '". check_query($edit["comment"]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')");
|
||||
db_query("INSERT INTO comments (nid, pid, uid, subject, comment, hostname, timestamp) VALUES ('%s', '%s', '$user->uid', '%s', '%s', '%s', '%s')", $edit["nid"], $edit["pid"], $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time());
|
||||
|
||||
/*
|
||||
** Add entry to the watchdog log:
|
||||
|
@ -291,8 +291,7 @@ function comment_post($edit) {
|
|||
** Redirect the user the node he commented on:
|
||||
*/
|
||||
|
||||
$url = "node.php?id=". $edit["nid"];
|
||||
drupal_goto($url);
|
||||
drupal_goto(drupal_url(array("id" => $edit["nid"], "node")));
|
||||
|
||||
}
|
||||
|
||||
|
@ -380,11 +379,11 @@ function comment_links($comment, $return = 1) {
|
|||
$links = array();
|
||||
|
||||
if ($return) {
|
||||
$links[] = "<a href=\"node.php?id=$comment->nid#$comment->cid\"><span style=\"color: $theme->type;\">". t("return") ."</span></a>";
|
||||
$links[] = l("<span style=\"color: $theme->type;\">". t("return") ."</span>", array("id" => $comment->nid."#".$comment->cid));;
|
||||
}
|
||||
|
||||
if (user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\" title=\"". t("Administer this comment.") ."\"><span style=\"color: $theme->type;\">". t("administer") ."</span></a>";
|
||||
$links[] = la("<span style=\"color: $theme->type;\">". t("administer") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid));
|
||||
}
|
||||
|
||||
// here we should check if this node has read-only comments, but we already check on submit
|
||||
|
@ -394,10 +393,10 @@ function comment_links($comment, $return = 1) {
|
|||
//if (node_comment_mode($comment->nid)) {
|
||||
if (user_access("post comments")) {
|
||||
if (comment_access("edit", $comment)) {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=edit&id=$comment->cid\" title=\"". t("Make changes to your comment.") ."\"><span style=\"color: $theme->type\">". t("edit your comment") ."</span></a>";
|
||||
$links[] = lm("<span style=\"color: $theme->type\">". t("edit your comment") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid), t("Make changes to your comment."));
|
||||
}
|
||||
else {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=reply&id=$comment->nid&pid=$comment->cid\" title=\"". t("Reply to this comment.") ."\"><span style=\"color: $theme->type;\">". t("reply to this comment") ."</span></a>";
|
||||
$links[] = lm("<span style=\"color: $theme->type;\">". t("reply to this comment") ."</span>", array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid), t("Reply to this comment."));
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
@ -417,7 +416,7 @@ function comment_view($comment, $folded = 0) {
|
|||
$theme->comment($comment, $folded);
|
||||
}
|
||||
else {
|
||||
print "<a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a> by ". format_name($comment) ."</small><p />";
|
||||
print l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid."#".$comment->cid)). " by ". format_name($comment) ."</small><p />";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +458,7 @@ function comment_thread_max($comments, $threshold, $pid = 0, $level = 0) {
|
|||
}
|
||||
|
||||
function comment_render($nid, $cid) {
|
||||
global $user, $theme, $mode, $order, $threshold, $REQUEST_URI;
|
||||
global $user, $theme, $mode, $order, $threshold;
|
||||
|
||||
if (user_access("access comments")) {
|
||||
|
||||
|
@ -489,7 +488,7 @@ function comment_render($nid, $cid) {
|
|||
}
|
||||
|
||||
print "<a name=\"comment\"></a>\n";
|
||||
print "<form method=\"post\" action=\"$REQUEST_URI\">\n";
|
||||
print "<form method=\"post\" action=\"".request_uri()."\">\n";
|
||||
|
||||
/*
|
||||
** Render control panel:
|
||||
|
@ -510,7 +509,7 @@ function comment_render($nid, $cid) {
|
|||
print " <tr><th>Subject</th><th>Author</th><th>Date</th><th>Score</th></tr>\n";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
if (comment_visible($comment, $threshold)) {
|
||||
print " <tr><td><a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a></td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
|
||||
print " <tr><td>".l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
|
@ -591,7 +590,7 @@ function comment_perm() {
|
|||
function comment_link($type, $node = 0, $main = 0) {
|
||||
|
||||
if ($type == "admin" && user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
$links[] = la(t("comments"), array("mod" => "comment"));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->comment) {
|
||||
|
@ -606,7 +605,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
$all = comment_num_all($node->nid);
|
||||
$new = comment_num_new($node->nid);
|
||||
|
||||
$links[] = "<a href=\"node.php?id=$node->nid#comment\" title=\"". t("View this posting and all of its comments.") ."\">". format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : "") ."</a>";
|
||||
$links[] = l(format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : ""), array("id" => $node->nid."#comment"), t("View this posting and all of its comments."));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -617,7 +616,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
|
||||
if (user_access("post comments")) {
|
||||
if ($node->comment == 2) {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=reply&id=$node->nid#comment\" title=\"". t("Share your thoughts and opinions related to this posting.") ."\">". t("add new comment") ."</a>";
|
||||
$links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid."#comment"), t("Share your thoughts and opinions related to this posting."));
|
||||
} else {
|
||||
$links[] = t("This discussion is closed: you can't post new comments.");
|
||||
}
|
||||
|
@ -643,7 +642,7 @@ function comment_node_link($node) {
|
|||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
$output .= "<tr><td>".l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>".l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>".la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid))."</td><td>".la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid))."</td></tr>";
|
||||
}
|
||||
|
||||
$output .= "</table>";
|
||||
|
@ -654,7 +653,7 @@ function comment_node_link($node) {
|
|||
|
||||
|
||||
function comment_save($id, $edit) {
|
||||
db_query("UPDATE comments SET subject = '". check_query(filter($edit["subject"])) ."', comment = '". check_query(filter($edit["comment"])) ."' WHERE cid = '$id'");
|
||||
db_query("UPDATE comments SET subject = '%s', comment = '%s' WHERE cid = '$id'", filter($edit["subject"]), filter($edit["comment"]));
|
||||
watchdog("special", "comment: modified '". $edit["subject"] ."'");
|
||||
}
|
||||
|
||||
|
@ -708,7 +707,7 @@ function comment_admin_overview() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>subject</th><th>author</th><th>date</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= " <tr><td><a href=\"node.php?id=$comment->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a></td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit comment</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">delete comment</a></td></tr>\n";
|
||||
$output .= " <tr><td>".l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>".la(t("edit comment"), array("mod" => comment, "op" => edit, "id" => $comment->cid))."</td><td>".la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -718,7 +717,7 @@ function comment_admin_overview() {
|
|||
function comment_delete($edit) {
|
||||
|
||||
if ($edit["confirm"]) {
|
||||
db_query("DELETE FROM comments WHERE cid = '". check_query($edit["cid"]) ."'");
|
||||
db_query("DELETE FROM comments WHERE cid = '%s'", $edit["cid"]);
|
||||
watchdog("special", "comment: deleted comment #". $edit["cid"]);
|
||||
}
|
||||
else {
|
||||
|
@ -737,14 +736,14 @@ function comment_admin() {
|
|||
|
||||
if (user_access("administer comments")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=comment\">overview</a> | <a href=\"admin.php?mod=comment&op=search\">search comment</a></small><hr />\n";
|
||||
print "<small>".la(t("overview"), array("mod" => "comment"))." | ".la(t("search comment"), array("mod" => "comment", "op" => "search"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "edit":
|
||||
print comment_admin_edit($id);
|
||||
break;
|
||||
case "search":
|
||||
print search_type("comment", "admin.php?mod=comment&op=search");
|
||||
print search_type("comment", drupal_url(array("mod" => "comment", "op" => "search"), "admin"));
|
||||
break;
|
||||
case "delete":
|
||||
print comment_delete(array("cid" => $id));
|
||||
|
|
|
@ -7,8 +7,8 @@ $GLOBALS["corder"] = array(1 => "Date - newest first", 2 => "Date - oldest first
|
|||
function comment_help() {
|
||||
$output .= "<p>The comment module enables users to submit posts that are directly associated with a piece of content. These associated posts are called <i>comments</i>. Comments may be <i>threaded</i>, which means that Drupal keeps track of multiple subconversations around a piece of content. Threading helps to keep the comment conversation more organized. Users are presented with several ways to view the comment conversation, and if desired, users may easily choose a <i>flat</i> presentation of comments instead of threaded. Further, users may choose to order their comments view by <i>newest first</i> or by <i>oldest first</i>. Finally, users may view a folded list or an expanded list of comments. Folded limits the comment display to <i>subject</i> only. Drupal remembers the comment view preference of each user whenever he changes a view setting.</p>";
|
||||
$output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>";
|
||||
$output .= "<p>Comments behave like other user submissions in Drupal. Specifically, <a href=\"admin.php?mod=system&type=filter\">filters</a> like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
|
||||
$output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the <a href=\"admin.php?mod=user&op=permission\"></a>user permissions</a> administration page. Additionally, administrators may edit or search through comments on the <a href=\"admin.php?mod=comment\">comments admininistration page<a>, as well as set the default display view for new users.</p>";
|
||||
$output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ".la("filters", array("mod" => "system", "type" => "filter"))." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>";
|
||||
$output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ".la("user permissions", array("mod" => "user", "op" => "permission"))." administration page. Additionally, administrators may edit or search through comments on the ".la("comments admininistration page", array("mod" => "comment")).", as well as set the default display view for new users.</p>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ function comment_num_new($nid) {
|
|||
** of new comments.
|
||||
*/
|
||||
|
||||
$history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '$nid'"));
|
||||
$comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE n.nid = '$nid' AND timestamp > '". ($history->timestamp ? $history->timestamp : 0) ."' GROUP BY n.nid"));
|
||||
$history = db_fetch_object(db_query("SELECT timestamp FROM history WHERE uid = '$user->uid' AND nid = '%s'", $nid));
|
||||
$comment = db_fetch_object(db_query("SELECT COUNT(c.nid) AS number FROM node n LEFT JOIN comments c ON n.nid = c.nid WHERE n.nid = '%s' AND timestamp > '". ($history->timestamp ? $history->timestamp : 0) ."' GROUP BY n.nid", $nid));
|
||||
|
||||
return $comment->number ? $comment->number : 0;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ function comment_reply($pid, $nid) {
|
|||
$context->nid = $nid;
|
||||
if (user_access("access comments", $context)) {
|
||||
if ($pid) {
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$pid'"));
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%s'", $pid));
|
||||
comment_view($comment, t("reply to this comment"));
|
||||
}
|
||||
else {
|
||||
|
@ -201,7 +201,7 @@ function comment_preview($edit) {
|
|||
$theme->box(t("Reply"), comment_form($edit));
|
||||
|
||||
if ($edit["pid"]) {
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$edit[pid]'"));
|
||||
$comment = db_fetch_object(db_query("SELECT c.*, u.uid, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '%s'", $edit[pid]));
|
||||
comment_view($comment, t("reply to this comment"));
|
||||
}
|
||||
else {
|
||||
|
@ -234,7 +234,7 @@ function comment_post($edit) {
|
|||
** validated/filtered data to perform such check.
|
||||
*/
|
||||
|
||||
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '". check_query($edit["pid"]) ."' AND nid = '". check_query($edit["nid"]) ."' AND subject = '". check_query($edit["subject"]) ."' AND comment = '". check_query($edit["comment"]) ."'"), 0);
|
||||
$duplicate = db_result(db_query("SELECT COUNT(cid) FROM comments WHERE pid = '%s' AND nid = '%s' AND subject = '%s' AND comment = '%s'", $edit["pid"], $edit["nid"], $edit["subject"], $edit["comment"]), 0);
|
||||
|
||||
if ($duplicate != 0) {
|
||||
watchdog("warning", "comment: duplicate '". $edit["subject"] ."'");
|
||||
|
@ -249,7 +249,7 @@ function comment_post($edit) {
|
|||
** user.
|
||||
*/
|
||||
|
||||
db_query("UPDATE comments SET subject = '". check_query($edit["subject"]) ."', comment = '". check_query($edit["comment"]) ."' WHERE cid = '". check_query($edit["cid"]) ."' AND uid = '$user->uid'");
|
||||
db_query("UPDATE comments SET subject = '%s', comment = '%s' WHERE cid = '%s' AND uid = '$user->uid'", $edit["subject"], $edit["comment"], $edit["cid"]);
|
||||
|
||||
/*
|
||||
** Add entry to the watchdog log:
|
||||
|
@ -269,7 +269,7 @@ function comment_post($edit) {
|
|||
** Add the comment to database:
|
||||
*/
|
||||
|
||||
db_query("INSERT INTO comments (nid, pid, uid, subject, comment, hostname, timestamp) VALUES ('". check_query($edit["nid"]) ."', '". check_query($edit["pid"]) ."', '$user->uid', '". check_query($edit["subject"]) ."', '". check_query($edit["comment"]) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')");
|
||||
db_query("INSERT INTO comments (nid, pid, uid, subject, comment, hostname, timestamp) VALUES ('%s', '%s', '$user->uid', '%s', '%s', '%s', '%s')", $edit["nid"], $edit["pid"], $edit["subject"], $edit["comment"], getenv("REMOTE_ADDR"), time());
|
||||
|
||||
/*
|
||||
** Add entry to the watchdog log:
|
||||
|
@ -291,8 +291,7 @@ function comment_post($edit) {
|
|||
** Redirect the user the node he commented on:
|
||||
*/
|
||||
|
||||
$url = "node.php?id=". $edit["nid"];
|
||||
drupal_goto($url);
|
||||
drupal_goto(drupal_url(array("id" => $edit["nid"], "node")));
|
||||
|
||||
}
|
||||
|
||||
|
@ -380,11 +379,11 @@ function comment_links($comment, $return = 1) {
|
|||
$links = array();
|
||||
|
||||
if ($return) {
|
||||
$links[] = "<a href=\"node.php?id=$comment->nid#$comment->cid\"><span style=\"color: $theme->type;\">". t("return") ."</span></a>";
|
||||
$links[] = l("<span style=\"color: $theme->type;\">". t("return") ."</span>", array("id" => $comment->nid."#".$comment->cid));;
|
||||
}
|
||||
|
||||
if (user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\" title=\"". t("Administer this comment.") ."\"><span style=\"color: $theme->type;\">". t("administer") ."</span></a>";
|
||||
$links[] = la("<span style=\"color: $theme->type;\">". t("administer") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid));
|
||||
}
|
||||
|
||||
// here we should check if this node has read-only comments, but we already check on submit
|
||||
|
@ -394,10 +393,10 @@ function comment_links($comment, $return = 1) {
|
|||
//if (node_comment_mode($comment->nid)) {
|
||||
if (user_access("post comments")) {
|
||||
if (comment_access("edit", $comment)) {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=edit&id=$comment->cid\" title=\"". t("Make changes to your comment.") ."\"><span style=\"color: $theme->type\">". t("edit your comment") ."</span></a>";
|
||||
$links[] = lm("<span style=\"color: $theme->type\">". t("edit your comment") ."</span>", array("mod" => "comment", "op" => "edit", "id" => $comment->cid), t("Make changes to your comment."));
|
||||
}
|
||||
else {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=reply&id=$comment->nid&pid=$comment->cid\" title=\"". t("Reply to this comment.") ."\"><span style=\"color: $theme->type;\">". t("reply to this comment") ."</span></a>";
|
||||
$links[] = lm("<span style=\"color: $theme->type;\">". t("reply to this comment") ."</span>", array("mod" => "comment", "op" => "reply", "id" => $comment->nid, "pid" => $comment->cid), t("Reply to this comment."));
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
@ -417,7 +416,7 @@ function comment_view($comment, $folded = 0) {
|
|||
$theme->comment($comment, $folded);
|
||||
}
|
||||
else {
|
||||
print "<a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a> by ". format_name($comment) ."</small><p />";
|
||||
print l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid."#".$comment->cid)). " by ". format_name($comment) ."</small><p />";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +458,7 @@ function comment_thread_max($comments, $threshold, $pid = 0, $level = 0) {
|
|||
}
|
||||
|
||||
function comment_render($nid, $cid) {
|
||||
global $user, $theme, $mode, $order, $threshold, $REQUEST_URI;
|
||||
global $user, $theme, $mode, $order, $threshold;
|
||||
|
||||
if (user_access("access comments")) {
|
||||
|
||||
|
@ -489,7 +488,7 @@ function comment_render($nid, $cid) {
|
|||
}
|
||||
|
||||
print "<a name=\"comment\"></a>\n";
|
||||
print "<form method=\"post\" action=\"$REQUEST_URI\">\n";
|
||||
print "<form method=\"post\" action=\"".request_uri()."\">\n";
|
||||
|
||||
/*
|
||||
** Render control panel:
|
||||
|
@ -510,7 +509,7 @@ function comment_render($nid, $cid) {
|
|||
print " <tr><th>Subject</th><th>Author</th><th>Date</th><th>Score</th></tr>\n";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
if (comment_visible($comment, $threshold)) {
|
||||
print " <tr><td><a href=\"node.php?id=$comment->nid&cid=$comment->cid#$comment->cid\">". check_output($comment->subject) ."</a></td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
|
||||
print " <tr><td>".l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>$comment->score</td></tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
|
@ -591,7 +590,7 @@ function comment_perm() {
|
|||
function comment_link($type, $node = 0, $main = 0) {
|
||||
|
||||
if ($type == "admin" && user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
$links[] = la(t("comments"), array("mod" => "comment"));
|
||||
}
|
||||
|
||||
if ($type == "node" && $node->comment) {
|
||||
|
@ -606,7 +605,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
$all = comment_num_all($node->nid);
|
||||
$new = comment_num_new($node->nid);
|
||||
|
||||
$links[] = "<a href=\"node.php?id=$node->nid#comment\" title=\"". t("View this posting and all of its comments.") ."\">". format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : "") ."</a>";
|
||||
$links[] = l(format_plural($all, "comment", "comments") . ($new ? ", $new ". t("new") : ""), array("id" => $node->nid."#comment"), t("View this posting and all of its comments."));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -617,7 +616,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
|
||||
if (user_access("post comments")) {
|
||||
if ($node->comment == 2) {
|
||||
$links[] = "<a href=\"module.php?mod=comment&op=reply&id=$node->nid#comment\" title=\"". t("Share your thoughts and opinions related to this posting.") ."\">". t("add new comment") ."</a>";
|
||||
$links[] = lm(t("add new comment"), array("mod" => "comment", "op" => "reply", "id" => $node->nid."#comment"), t("Share your thoughts and opinions related to this posting."));
|
||||
} else {
|
||||
$links[] = t("This discussion is closed: you can't post new comments.");
|
||||
}
|
||||
|
@ -643,7 +642,7 @@ function comment_node_link($node) {
|
|||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
$output .= "<tr><td>".l($comment->subject, array("id" => $node->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>".l(t("view comment"), array("id" => $node->nid, "cid" => $comment->cid."#".$comment->cid))."</td><td>".la(t("edit comment"), array("mod" => "comment", "op" => "edit", "id" => $comment->cid))."</td><td>".la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid))."</td></tr>";
|
||||
}
|
||||
|
||||
$output .= "</table>";
|
||||
|
@ -654,7 +653,7 @@ function comment_node_link($node) {
|
|||
|
||||
|
||||
function comment_save($id, $edit) {
|
||||
db_query("UPDATE comments SET subject = '". check_query(filter($edit["subject"])) ."', comment = '". check_query(filter($edit["comment"])) ."' WHERE cid = '$id'");
|
||||
db_query("UPDATE comments SET subject = '%s', comment = '%s' WHERE cid = '$id'", filter($edit["subject"]), filter($edit["comment"]));
|
||||
watchdog("special", "comment: modified '". $edit["subject"] ."'");
|
||||
}
|
||||
|
||||
|
@ -708,7 +707,7 @@ function comment_admin_overview() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>subject</th><th>author</th><th>date</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= " <tr><td><a href=\"node.php?id=$comment->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a></td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit comment</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">delete comment</a></td></tr>\n";
|
||||
$output .= " <tr><td>".l(check_output($comment->subject), array("id" => $comment->nid, "cid" => $comment->cid, "pid" => $comment->pid."#".$comment->cid))."</td><td>". format_name($comment) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>".la(t("edit comment"), array("mod" => comment, "op" => edit, "id" => $comment->cid))."</td><td>".la(t("delete comment"), array("mod" => "comment", "op" => "delete", "id" => $comment->cid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -718,7 +717,7 @@ function comment_admin_overview() {
|
|||
function comment_delete($edit) {
|
||||
|
||||
if ($edit["confirm"]) {
|
||||
db_query("DELETE FROM comments WHERE cid = '". check_query($edit["cid"]) ."'");
|
||||
db_query("DELETE FROM comments WHERE cid = '%s'", $edit["cid"]);
|
||||
watchdog("special", "comment: deleted comment #". $edit["cid"]);
|
||||
}
|
||||
else {
|
||||
|
@ -737,14 +736,14 @@ function comment_admin() {
|
|||
|
||||
if (user_access("administer comments")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=comment\">overview</a> | <a href=\"admin.php?mod=comment&op=search\">search comment</a></small><hr />\n";
|
||||
print "<small>".la(t("overview"), array("mod" => "comment"))." | ".la(t("search comment"), array("mod" => "comment", "op" => "search"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "edit":
|
||||
print comment_admin_edit($id);
|
||||
break;
|
||||
case "search":
|
||||
print search_type("comment", "admin.php?mod=comment&op=search");
|
||||
print search_type("comment", drupal_url(array("mod" => "comment", "op" => "search"), "admin"));
|
||||
break;
|
||||
case "delete":
|
||||
print comment_delete(array("cid" => $id));
|
||||
|
|
|
@ -51,8 +51,8 @@ function drupal_directory_ping($arguments) {
|
|||
*/
|
||||
|
||||
if ($link && $name && $mail && $slogan && $mission) {
|
||||
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."' OR mail = '". check_query($mail) ."'");
|
||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
||||
db_query("DELETE FROM directory WHERE link = '%s' OR mail = '%s'", $link, $mail);
|
||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $link, $name, $mail, $slogan, $mission, time());
|
||||
|
||||
watchdog("message", "directory: ping from '$name' ($link)");
|
||||
|
||||
|
@ -135,7 +135,7 @@ function drupal_auth_help() {
|
|||
$output = "<p><a href=\"http://www.drupal.org\">Drupal</a> is the name of the software which powers %s. There are Drupal websites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n";
|
||||
$output .= "<p>So please feel free to login to your account here at %s with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b><i>@www.drupal.org</i>.</p>";
|
||||
|
||||
return strtr(t($output), array("%s" => "<i>$site</i>"));
|
||||
return t($output, array("%s" => "<i>$site</i>"));
|
||||
}
|
||||
|
||||
function drupal_user($type, $edit, $user) {
|
||||
|
|
|
@ -51,8 +51,8 @@ function drupal_directory_ping($arguments) {
|
|||
*/
|
||||
|
||||
if ($link && $name && $mail && $slogan && $mission) {
|
||||
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."' OR mail = '". check_query($mail) ."'");
|
||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
||||
db_query("DELETE FROM directory WHERE link = '%s' OR mail = '%s'", $link, $mail);
|
||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $link, $name, $mail, $slogan, $mission, time());
|
||||
|
||||
watchdog("message", "directory: ping from '$name' ($link)");
|
||||
|
||||
|
@ -135,7 +135,7 @@ function drupal_auth_help() {
|
|||
$output = "<p><a href=\"http://www.drupal.org\">Drupal</a> is the name of the software which powers %s. There are Drupal websites all over the world, and many of them share their registration databases so that users may freely login to any Drupal site using a single <b>Drupal ID</b>.</p>\n";
|
||||
$output .= "<p>So please feel free to login to your account here at %s with a username from another Drupal site. The format of a Drupal ID is similar to an email address: <b>username</b>@<i>server</i>. An example of valid Drupal ID is <b>mwlily</b><i>@www.drupal.org</i>.</p>";
|
||||
|
||||
return strtr(t($output), array("%s" => "<i>$site</i>"));
|
||||
return t($output, array("%s" => "<i>$site</i>"));
|
||||
}
|
||||
|
||||
function drupal_user($type, $edit, $user) {
|
||||
|
|
|
@ -35,11 +35,11 @@ function forum_save($op, $node) {
|
|||
|
||||
function forum_link($type) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=forum\" title=\"". t("Read and participate in the discussion forums.") ."\">". t("forum") ."</a>";
|
||||
$links[] = lm(t("forum"), array("mod" => "forum"), t("Read and participate in the discussion forums."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=forum\" title=\"". t("Add a new discussion forum.") ."\">". t("create forum") ."</a>";
|
||||
$links[] = lm(t("create forum"), array("mod" => "node", "op" => "add", "type" => "forum"), t("Add a new discussion forum."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -47,7 +47,7 @@ function forum_link($type) {
|
|||
|
||||
function forum_view($node) {
|
||||
global $theme;
|
||||
$output .= "<p><a href=\"module.php?mod=forum\">". t("Forum") ."</a> / <b><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></b>:</p><p>". check_output($node->body) ."</p>";
|
||||
$output .= "<p>".lm(t("Forum"), array("mod" => "forum"))." / <b>".l(check_output($node->title), array("id" => $node->nid))."</b>:</p><p>". check_output($node->body) ."</p>";
|
||||
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
|
||||
|
||||
$theme->box(t("Discussion forum"), $output);
|
||||
|
@ -81,7 +81,7 @@ function forum_page() {
|
|||
$output .= " <tr><th>". t("Forum") ."</th><th>". t("Comments") ."</th><th>". t("Last comment") ."</th></tr>";
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$node = node_load(array("nid" => $node->nid));
|
||||
$output .= " <tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br /><small>". check_output($node->body, 1) ."</small></td><td align=\"center\">". forum_num_comments($node->nid) ."</td><td align=\"center\">". forum_last_comment($node->nid) ."</td></tr>";
|
||||
$output .= " <tr><td>".l(check_output($node->title), array("id" => $node->nid))."<br /><small>". check_output($node->body, 1) ."</small></td><td align=\"center\">". forum_num_comments($node->nid) ."</td><td align=\"center\">". forum_last_comment($node->nid) ."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ function forum_save($op, $node) {
|
|||
|
||||
function forum_link($type) {
|
||||
if ($type == "page" && user_access("access content")) {
|
||||
$links[] = "<a href=\"module.php?mod=forum\" title=\"". t("Read and participate in the discussion forums.") ."\">". t("forum") ."</a>";
|
||||
$links[] = lm(t("forum"), array("mod" => "forum"), t("Read and participate in the discussion forums."));
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=forum\" title=\"". t("Add a new discussion forum.") ."\">". t("create forum") ."</a>";
|
||||
$links[] = lm(t("create forum"), array("mod" => "node", "op" => "add", "type" => "forum"), t("Add a new discussion forum."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -47,7 +47,7 @@ function forum_link($type) {
|
|||
|
||||
function forum_view($node) {
|
||||
global $theme;
|
||||
$output .= "<p><a href=\"module.php?mod=forum\">". t("Forum") ."</a> / <b><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></b>:</p><p>". check_output($node->body) ."</p>";
|
||||
$output .= "<p>".lm(t("Forum"), array("mod" => "forum"))." / <b>".l(check_output($node->title), array("id" => $node->nid))."</b>:</p><p>". check_output($node->body) ."</p>";
|
||||
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
|
||||
|
||||
$theme->box(t("Discussion forum"), $output);
|
||||
|
@ -81,7 +81,7 @@ function forum_page() {
|
|||
$output .= " <tr><th>". t("Forum") ."</th><th>". t("Comments") ."</th><th>". t("Last comment") ."</th></tr>";
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$node = node_load(array("nid" => $node->nid));
|
||||
$output .= " <tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a><br /><small>". check_output($node->body, 1) ."</small></td><td align=\"center\">". forum_num_comments($node->nid) ."</td><td align=\"center\">". forum_last_comment($node->nid) ."</td></tr>";
|
||||
$output .= " <tr><td>".l(check_output($node->title), array("id" => $node->nid))."<br /><small>". check_output($node->body, 1) ."</small></td><td align=\"center\">". forum_num_comments($node->nid) ."</td><td align=\"center\">". forum_last_comment($node->nid) ."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
function help_link($type) {
|
||||
if ($type == "admin") {
|
||||
$links[] = "<a href=\"admin.php?mod=help\">help</a>";
|
||||
$links[] = la(t("help"), array("mod" => "help"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
function help_link($type) {
|
||||
if ($type == "admin") {
|
||||
$links[] = "<a href=\"admin.php?mod=help\">help</a>";
|
||||
$links[] = la(t("help"), array("mod" => "help"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -25,11 +25,11 @@ function import_perm() {
|
|||
|
||||
function import_link($type) {
|
||||
if ($type == "admin" && user_access("administer news feeds")) {
|
||||
$links[] = "<a href=\"admin.php?mod=import\">news feeds</a>";
|
||||
$links[] = la(t("news feeds"), array("mod" => "import"));
|
||||
}
|
||||
|
||||
if ($type == "page" && user_access("access news feeds")) {
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("news feeds") ."</a>";
|
||||
$links[] = lm(t("news feeds"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -53,9 +53,10 @@ function import_format_item($item, $feed = 0) {
|
|||
global $theme, $user;
|
||||
|
||||
if ($user->uid && user_access("post blogs")) {
|
||||
$output .= "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\"><img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" /></a> ";
|
||||
$output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
}
|
||||
|
||||
// external link
|
||||
$output .= "<a href=\"". check_output($item->link) ."\" target=\"new\">". check_output($item->title) ."</a>";
|
||||
|
||||
return $output ."<br />";
|
||||
|
@ -78,7 +79,7 @@ function import_bundle_block($attributes) {
|
|||
}
|
||||
|
||||
function import_feed_block($feed) {
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '$feed->fid' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_block_limit", 15), $feed->fid);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= import_format_item($item);
|
||||
|
@ -97,7 +98,7 @@ function import_get_bundles($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $bundle->title;
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=bundle&id=$bundle->bid\" title=\"". t("View this bundle's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_bundle_block($bundle->attributes) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), t("View this bundle's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$bundle->title bundle";
|
||||
|
||||
$i++;
|
||||
|
@ -112,7 +113,7 @@ function import_get_feeds($attributes = 0) {
|
|||
$i = 0;
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$block[$i]["subject"] = $feed->title;
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\"><a href=\"module.php?mod=import&op=feed&id=$feed->fid\" title=\"". t("View this feed's recent news.") ."\">". t("more") ."</a></div></p>";
|
||||
$block[$i]["content"] = import_feed_block($feed) ."<p><div align=\"right\">".lm(t("more"), array("mod" => "import", "op" => "feed", "id" => $feed->fid), t("View this feed's recent news."))."</div></p>";
|
||||
$block[$i]["info"] = "$feed->title feed";
|
||||
|
||||
$i++;
|
||||
|
@ -122,7 +123,7 @@ function import_get_feeds($attributes = 0) {
|
|||
}
|
||||
|
||||
function import_remove($feed) {
|
||||
db_query("DELETE FROM item WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $feed["fid"]);
|
||||
return "feed '". $feed["title"] ."' reset.";
|
||||
}
|
||||
|
||||
|
@ -175,7 +176,7 @@ function import_refresh($feed) {
|
|||
$link = strip_tags($link[1]);
|
||||
$description = filter(strtr($description[1], $tt));
|
||||
|
||||
db_query("UPDATE feed SET timestamp = '". time() ."', link = '". check_input($link) ."', description = '". check_input($description) ."' WHERE fid = '". $feed["fid"] ."'");
|
||||
db_query("UPDATE feed SET timestamp = '%s', link = '%s', description = '%s' WHERE fid = '%s'",time(), $link, $description, $feed["fid"]);
|
||||
|
||||
/*
|
||||
** Extract and process individual items:
|
||||
|
@ -214,10 +215,10 @@ function import_refresh($feed) {
|
|||
*/
|
||||
|
||||
if ($link && $link != $feed["link"] && $link != $feed["url"]) {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND link = '". check_query($link) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND link = '%s'", $feed["fid"], $link));
|
||||
}
|
||||
else {
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '". check_query($feed["fid"]) ."' AND title = '". check_query($title) ."'"));
|
||||
$entry = db_fetch_object(db_query("SELECT iid FROM item WHERE fid = '%s' AND title = '%s'", $feed["fid"], $title));
|
||||
}
|
||||
|
||||
import_save_item(array(iid => $entry->iid, fid => $feed["fid"], title => $title, link => $link, author => $author, description => $description, attributes => $feed["attributes"]));
|
||||
|
@ -230,7 +231,7 @@ function import_refresh($feed) {
|
|||
|
||||
unset($items);
|
||||
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '". $feed["fid"] ."' ORDER BY timestamp");
|
||||
$result = db_query("SELECT iid FROM item WHERE fid = '%s' ORDER BY timestamp", $feed["fid"]);
|
||||
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$items[] = "iid = '$item->iid'";
|
||||
|
@ -250,13 +251,13 @@ function import_refresh($feed) {
|
|||
|
||||
function import_save_item($edit) {
|
||||
if ($edit["iid"] && $edit["title"]) {
|
||||
db_query("UPDATE item SET title = '". check_input($edit["title"]) ."', link = '". check_input($edit["link"]) ."', author = '". check_input($edit["author"]) ."', description = '". check_input($edit["description"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("UPDATE item SET title = '%s', link = '%s', author = '%s', description = '%s', attributes = '%s' WHERE iid = '%s'", $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], $edit["iid"]);
|
||||
}
|
||||
else if ($edit["iid"]) {
|
||||
db_query("DELETE FROM item WHERE iid = '". check_input($edit["iid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE iid = '%s'", $edit["iid"]);
|
||||
}
|
||||
else if ($edit["title"] && $edit["link"]) {
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('". check_input($edit["fid"]) ."', '". check_input($edit["title"]) ."', '". check_input($edit["link"]) ."', '". check_input($edit["author"]) ."', '". check_input($edit["description"]) ."', '". check_input($edit["attributes"]) ."', '". time() ."')");
|
||||
db_query("INSERT INTO item (fid, title, link, author, description, attributes, timestamp) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", $edit["fid"], $edit["title"], $edit["link"], $edit["author"], $edit["description"], $edit["attributes"], time());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,13 +278,13 @@ function import_form_bundle($edit = array()) {
|
|||
|
||||
function import_save_bundle($edit) {
|
||||
if ($edit["bid"] && $edit["title"]) {
|
||||
db_query("UPDATE bundle SET title = '". check_input($edit["title"]) ."', attributes = '". check_input($edit["attributes"]) ."' WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("UPDATE bundle SET title = '%s', attributes = '%s' WHERE bid = '%s'", $edit["title"], $edit["attributes"], $edit["bid"]);
|
||||
}
|
||||
else if ($edit["bid"]) {
|
||||
db_query("DELETE FROM bundle WHERE bid = '". check_input($edit["bid"]) ."'");
|
||||
db_query("DELETE FROM bundle WHERE bid = '%s'", $edit["bid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["attributes"]) ."')");
|
||||
db_query("INSERT INTO bundle (title, attributes) VALUES ('%s', '%s')", $edit["title"], $edit["attributes"]);
|
||||
}
|
||||
|
||||
module_rehash_blocks("import");
|
||||
|
@ -314,31 +315,31 @@ function import_form_feed($edit = array()) {
|
|||
|
||||
function import_save_feed($edit) {
|
||||
if ($edit["fid"] && $edit["title"]) {
|
||||
db_query("UPDATE feed SET title = '". check_input($edit["title"]) ."', url = '". check_input($edit["url"]) ."', attributes = '". check_input($edit["attributes"]) ."', refresh = '". check_input($edit["refresh"]) ."' WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("UPDATE feed SET title = '%s', url = '%s', attributes = '%s', refresh = '%s' WHERE fid = '%s'", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"], $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["fid"]) {
|
||||
db_query("DELETE FROM feed WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM item WHERE fid = '". check_input($edit["fid"]) ."'");
|
||||
db_query("DELETE FROM feed WHERE fid = '%s'", $edit["fid"]);
|
||||
db_query("DELETE FROM item WHERE fid = '%s'", $edit["fid"]);
|
||||
}
|
||||
else if ($edit["title"]) {
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('". check_input($edit["title"]) ."', '". check_input($edit["url"]) ."', '". check_input($edit["attributes"]) ."', '". check_input($edit["refresh"]) ."')");
|
||||
db_query("INSERT INTO feed (title, url, attributes, refresh) VALUES ('%s', '%s', '%s', '%s')", $edit["title"], $edit["url"], $edit["attributes"], $edit["refresh"]);
|
||||
}
|
||||
}
|
||||
|
||||
function import_save_attributes($edit) {
|
||||
foreach ($edit as $iid => $value) {
|
||||
db_query("UPDATE item SET attributes = '". check_input($value) ."' WHERE iid = '". check_input($iid) ."'");
|
||||
db_query("UPDATE item SET attributes = '%s' WHERE iid = '%s'", $value, $iid);
|
||||
}
|
||||
return "attributes has been saved";
|
||||
}
|
||||
|
||||
function import_get_feed($fid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
}
|
||||
|
||||
function import_get_bundle($bid) {
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
return db_fetch_array(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
}
|
||||
|
||||
function import_view() {
|
||||
|
@ -348,7 +349,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>items</th><th>last update</th><th>next update</th><th colspan=\"3\">operations</th></tr>\n";
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td><a href=\"admin.php?mod=import&type=feed&op=edit&id=$feed->fid\">edit feed</a></td><td><a href=\"admin.php?mod=import&type=feed&op=remove&id=$feed->fid\">remove items</a></td><td><a href=\"admin.php?mod=import&type=feed&op=update&id=$feed->fid\">update items</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($feed->title) ."</td><td>". check_output($feed->attributes) ."</td><td>". format_plural($feed->items, "item", "items") ."</td><td>". ($feed->timestamp ? format_interval(time() - $feed->timestamp) ." ago" : "never") ."</td><td>". ($feed->timestamp ? format_interval($feed->timestamp + $feed->refresh - time()) ." left" : "never") ."</td><td>".la(t("edit feed"), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $feed->fid))."</td><td>" .la(t("remove items"), array("mod" => "import", "type" => "feed", "op" => "remove", "id" => $feed->fid)). "</td><td>". la(t("update items"), array("mod" => "import", "type" => "feed", "op" => "update", "id" => $feed->fid)). "</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -358,7 +359,7 @@ function import_view() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>attributes</th><th>operations</th></tr>\n";
|
||||
while ($bundle = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td><a href=\"admin.php?mod=import&type=bundle&op=edit&id=$bundle->bid\">edit bundle</a></td></tr>\n";
|
||||
$output .= " <tr><td>". check_output($bundle->title) ."</td><td>". check_output($bundle->attributes) ."</td><td>".la(t("edit bundle"), array("mod" => "import", "type" => "bundle", "op" => "edit", "id" => $bundle->bid))."</td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
|
||||
|
@ -402,7 +403,7 @@ function import_fd_collect($edit) {
|
|||
$title = strip_tags(strtr($title[1], $tt));
|
||||
|
||||
// print "<b>title = $title, link = $link<br /></b>";
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '". check_input($link) ."'"))) {
|
||||
if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) {
|
||||
$output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />";
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +432,7 @@ function import_tag() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>time</th><th>feed</th><th>item</th></tr>\n";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\"><a href=\"admin.php?mod=import&type=feed&op=edit&id=$item->fid\">". check_output($item->feed) ."</a></td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
$output .= " <tr><td valign=\"top\" nowrap=\"nowrap\">". format_date($item->timestamp, "custom", "m/d/y") ."<br />". format_date($item->timestamp, "custom", "H:i") ."</td><td align=\"center\" valign=\"top\" nowrap=\"nowrap\">".la(check_output($item->feed), array("mod" => "import", "type" => "feed", "op" => "edit", "id" => $item->fid))."</td><td><a href=\"". check_output($item->link) ."\">". check_output($item->title) ."</a>". ($item->description ? "<br /><small><i>". check_output($item->description, 1) ."</i></small>" : "") ."<br /><input type=\"text\" name=\"edit[$item->iid]\" value=\"". check_form($item->attributes) ."\" size=\"50\" /></td></tr>\n";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
$output .= "<input type=\"submit\" name=\"op\" value=\"Save attributes\" />\n";
|
||||
|
@ -444,7 +445,14 @@ function import_admin() {
|
|||
|
||||
if (user_access("administer news feeds")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=import&type=feed&op=add\">add new feed</a> | <a href=\"admin.php?mod=import&type=bundle&op=add\">add new bundle</a> | <a href=\"admin.php?mod=import&op=fd\">import feeds</a> | <a href=\"admin.php?mod=import&op=tag\">tag items</a> | <a href=\"admin.php?mod=import&op=view\">overview</a> | <a href=\"admin.php?mod=import&op=help\">help</a></small><hr />";
|
||||
$links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add"));
|
||||
$links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add"));
|
||||
$links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd"));
|
||||
$links[] = la(t("tag items"), array("mod" => "import", "op" => "tag"));
|
||||
$links[] = la(t("overview"), array("mod" => "import", "op" => "view"));
|
||||
$links[] = la(t("help"), array("mod" => "import", "op" => "help"));
|
||||
|
||||
print "<small>".implode(" | ", $links)."</small><hr />";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
@ -514,10 +522,10 @@ function import_admin() {
|
|||
function import_page_info() {
|
||||
global $theme;
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=import\" title=\"". t("Read the latest news from syndicated websites.") ."\">". t("latest news") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feeds\" title=\"". t("View the latest headlines sorted by source.") ."\">". t("news by source") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=bundles\" title=\"". t("View the latest headlines sorted by topic.") ."\">". t("news by topic") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=sources\" title=\"". t("View a list of all the websites we syndicate from.") ."\">". t("news sources") ."</a>";
|
||||
$links[] = lm(t("latest news"), array("mod" => "import"), t("Read the latest news from syndicated websites."));
|
||||
$links[] = lm(t("news by source"), array("mod" => "import", "op" => "feeds"), t("View the latest headlines sorted by source."));
|
||||
$links[] = lm(t("news by topic"), array("mod" => "import", "op" => "bundles"), t("View the latest headlines sorted by topic."));
|
||||
$links[] = lm(t("news sources"), array("mod" => "import", "op" => "sources"), t("View a list of all the websites we syndicate from."));
|
||||
|
||||
return "<div align=\"center\">". $theme->links($links) ."</div>";
|
||||
}
|
||||
|
@ -529,11 +537,11 @@ function import_page_last() {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -553,17 +561,17 @@ function import_page_last() {
|
|||
function import_page_feed($fid) {
|
||||
global $theme;
|
||||
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '". check_input($fid) ."'"));
|
||||
$feed = db_fetch_object(db_query("SELECT * FROM feed WHERE fid = '%s'", $fid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url($feed->link) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div></p>";
|
||||
$header .= "<p><b>". t("Last update") .":</b><div style=\"margin-left: 20px;\">". format_interval(time() - $feed->timestamp) ." ". t("ago") ."<a href=\"$feed->url\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br /><br /></div></p>\n";
|
||||
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '". check_input($fid) ."' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75));
|
||||
$result = db_query("SELECT * FROM item WHERE fid = '%s' ORDER BY iid DESC LIMIT ". variable_get("import_page_limit", 75), $fid);
|
||||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
|
@ -586,9 +594,9 @@ function import_page_feed($fid) {
|
|||
function import_page_bundle($bid) {
|
||||
global $theme;
|
||||
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
|
||||
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '%s'", $bid));
|
||||
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url("module.php?mod=import&op=bundle&id=$bundle->bid") ."</div></p>";
|
||||
$header .= "<p><b>". t("Website") .":</b><div style=\"margin-left: 20px;\">". format_url(drupal_url(array("mod" => "import", "op" => "bundle", "id" => $bundle->bid), "module")) ."</div></p>";
|
||||
$header .= "<p><b>". t("Description") .":</b><div style=\"margin-left: 20px;\">". t("A composite news feed about") ." ". check_output($bundle->attributes) .".</div></p>";
|
||||
|
||||
$keys = explode(",", $bundle->attributes);
|
||||
|
@ -597,12 +605,12 @@ function import_page_bundle($bid) {
|
|||
|
||||
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
|
||||
while ($item = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=blog&iid=$item->iid\" title=\"". t("Comment on this news item in your personal blog.") ."\">". t("blog it") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("Read more syndicated news from this feed.") ."\">". t("feed") ."</a>";
|
||||
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), t("Comment on this news item in your personal blog."));
|
||||
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), t("Read more syndicated news from this feed."));
|
||||
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
|
||||
|
||||
if ($item->link) {
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · <a href=\"module.php?mod=import&op=feed&id=$item->fid\" title=\"". t("View more information about this feed.") ."\">$item->ftitle</a></td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
$output .= "<tr><td>". format_url($item->link, $item->title) ." · ".lm($item->ftitle, array("mod" => "import", "op" => "feed", "id" => $item->fid), t("View more information about this feed."))."</td><td align=\"right\" nowrap=\"nowrap\" valign=\"top\">". $theme->links($links) ."</td></tr>\n";
|
||||
}
|
||||
|
||||
if ($item->description) {
|
||||
|
@ -626,11 +634,11 @@ function import_page_sources() {
|
|||
$result = db_query("SELECT * FROM feed ORDER BY title");
|
||||
|
||||
while ($feed = db_fetch_object($result)) {
|
||||
$output .= format_url("module.php?mod=import&op=feed&id=$feed->fid", $feed->title);
|
||||
$output .= format_url(drupal_url(array("mod" => "import", "op" => "feed", "id" => $feed->fid), "module"), $feed->title);
|
||||
$output .= "<div style=\"margin-left: 20px;\">". check_output($feed->description, 1) ."</div><br />";
|
||||
}
|
||||
|
||||
$output .= "<a href=\"module.php?mod=import&op=fd\" title=\"". t("View the list of syndicated websites in XML format.") ."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" /></a><br />\n";
|
||||
$output .= lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" align=\"right\" border=\"0\" />", array("mod" => "import", "op" => "fd"), t("View the list of syndicated websites in XML format."))."<br />\n";
|
||||
|
||||
$theme->header();
|
||||
$theme->box(t("News feeds"), import_page_info());
|
||||
|
|
|
@ -153,7 +153,7 @@ function jabber_auth_help() {
|
|||
<p>You may login to %s using a <b>Jabber ID</b>. The format of a Jabber ID is the same as an email address: <b>name</b><i>@server</i> An example of valid Jabber ID is <b>mwlily</b><i>@jabber.com</i>.</p>
|
||||
<p>Jabber is an <a href=\"http://www.opensource.org\">open source</a> instant messaging system designed to give the power of choice and freedom back to the users of instant messaging. By creating an extensible and powerful server and protocol, Jabber has succeeded in this goal. Not only does Jabber allow its users to use (and create) clients for numerous platforms, but it allows people to communicate to whomever they want in the way which is most convenient for them.</p>";
|
||||
|
||||
return strtr(t($output), array("%s" => "<i>$site</i>"));
|
||||
return t($output, array("%s" => "<i>$site</i>"));
|
||||
}
|
||||
|
||||
function jabber_user($type, $edit, $user) {
|
||||
|
@ -166,7 +166,7 @@ function jabber_user($type, $edit, $user) {
|
|||
return $output;
|
||||
case "edit_form":
|
||||
$result = user_get_authname($user, $module);
|
||||
$output .= form_textfield("$name ID", "authname_" . $module, $result, 30, 55, strtr(t("You may login to %s using a valid %id."), array("%s" => variable_get("site_name", "this web site"), "%id" => "<a href=\"module.php?mod=user&op=help#$module\">$name ID</a>")));
|
||||
$output .= form_textfield("$name ID", "authname_" . $module, $result, 30, 55, t("You may login to %s using a valid %id.", array("%s" => variable_get("site_name", "this web site"), "%id" => lm($name ID, array("mod" => "user", "op" => "help#".$module)))));
|
||||
return $output;
|
||||
case "edit_validate":
|
||||
return user_validate_authmap($user, $edit["authname_$module"], $module);
|
||||
|
|
|
@ -41,7 +41,7 @@ function locale_perm() {
|
|||
|
||||
function locale_link($type) {
|
||||
if ($type == "admin" && user_access("administer locales")) {
|
||||
$links[] = "<a href=\"admin.php?mod=locale\">locales</a>";
|
||||
$links[] = la(t("locales"), array("mod" => "locale"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -59,7 +59,7 @@ function locale_delete($lid) {
|
|||
function locale_save($lid) {
|
||||
global $edit;
|
||||
foreach ($edit as $key=>$value) {
|
||||
db_query("UPDATE locales SET $key = '". check_query($value) ."' WHERE lid = '$lid'");
|
||||
db_query("UPDATE locales SET $key = '%s' WHERE lid = '$lid'", $value);
|
||||
}
|
||||
locale_refresh_cache();
|
||||
// delete form data so it will remember where it came from
|
||||
|
@ -70,7 +70,7 @@ function locale_refresh_cache() {
|
|||
global $languages;
|
||||
|
||||
foreach (array_keys($languages) as $locale) {
|
||||
$result = db_query("SELECT string, ". check_query($locale) ." FROM locales");
|
||||
$result = db_query("SELECT string, %s FROM locales", $locale);
|
||||
while ($data = db_fetch_object($result)) {
|
||||
$t[$data->string] = $data->$locale;
|
||||
}
|
||||
|
@ -106,10 +106,10 @@ function locale_links($translation) {
|
|||
|
||||
foreach ($languages as $key=>$value) {
|
||||
if ($translation) {
|
||||
$output .= "<a href=\"admin.php?mod=locale&op=translated&language=$key\">translated '$key' strings</a> | ";
|
||||
$output .= la(t("translated '$key' strings"), array("mod" => "locale", "op" => "translated", "language" => $key))." | ";
|
||||
}
|
||||
else {
|
||||
$output .= "<a href=\"admin.php?mod=locale&op=untranslated&language=$key\">untranslated '$key' strings</a> | ";
|
||||
$output .= la(t("untranslated '$key' strings"), array("mod" => "locale", "op" => "untranslated", "language" => $key))." | ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ function locale_seek() {
|
|||
$output .= "<td align=\"center\">". check_output(locale_languages($locale)) ."</td>";
|
||||
}
|
||||
|
||||
$output .= "<td nowrap=\"nowrap\"><a href=\"admin.php?mod=locale&op=edit&id=$locale->lid\">edit locale</a></td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=locale&op=delete&id=$locale->lid\">delete locale</a></td></tr>";
|
||||
$output .= "<td nowrap=\"nowrap\">".la(t("edit locale"), array("mod" => "locale", "op" => "edit", "id" => $locale->lid))."</td><td nowrap=\"nowrap\">".la(t("delete locale"), array("mod" => "locale", "op" => "delete", "id" => $locale->lid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ function locale_admin() {
|
|||
print status("locale disabled.");
|
||||
}
|
||||
else if (user_access("administer locales")) {
|
||||
print "<small>". locale_links(1) . locale_links(0) ."<a href=\"admin.php?mod=locale&op=Search\">search</a> | <a href=\"admin.php?mod=locale&op=overview\">overview</a> | <a href=\"admin.php?mod=locale&op=help\">help</a></small><hr />\n";
|
||||
print "<small>". locale_links(1) . locale_links(0) .la(t("search"), array("mod" => "locale", "op" => "Search"))." | ".la(t("overview"), array("mod" => "locale", "op" => "overview"))." | ".la(t("help"), array("mod" => "locale", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "delete":
|
||||
|
@ -266,9 +266,9 @@ function locale($string) {
|
|||
$string = check_output($locale_t[$string]);
|
||||
}
|
||||
else {
|
||||
$result = db_query("SELECT lid, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
|
||||
$result = db_query("SELECT lid, $locale FROM locales WHERE string = '%s'", $string);
|
||||
if (!db_fetch_object($result)) {
|
||||
db_query("INSERT INTO locales (string, location) VALUES ('". check_query($string) ."', '". check_query(getenv("REQUEST_URI")) ."')");
|
||||
db_query("INSERT INTO locales (string, location) VALUES ('%s', '%s')", $string, getenv("PATH_INFO"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ function locale_perm() {
|
|||
|
||||
function locale_link($type) {
|
||||
if ($type == "admin" && user_access("administer locales")) {
|
||||
$links[] = "<a href=\"admin.php?mod=locale\">locales</a>";
|
||||
$links[] = la(t("locales"), array("mod" => "locale"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -59,7 +59,7 @@ function locale_delete($lid) {
|
|||
function locale_save($lid) {
|
||||
global $edit;
|
||||
foreach ($edit as $key=>$value) {
|
||||
db_query("UPDATE locales SET $key = '". check_query($value) ."' WHERE lid = '$lid'");
|
||||
db_query("UPDATE locales SET $key = '%s' WHERE lid = '$lid'", $value);
|
||||
}
|
||||
locale_refresh_cache();
|
||||
// delete form data so it will remember where it came from
|
||||
|
@ -70,7 +70,7 @@ function locale_refresh_cache() {
|
|||
global $languages;
|
||||
|
||||
foreach (array_keys($languages) as $locale) {
|
||||
$result = db_query("SELECT string, ". check_query($locale) ." FROM locales");
|
||||
$result = db_query("SELECT string, %s FROM locales", $locale);
|
||||
while ($data = db_fetch_object($result)) {
|
||||
$t[$data->string] = $data->$locale;
|
||||
}
|
||||
|
@ -106,10 +106,10 @@ function locale_links($translation) {
|
|||
|
||||
foreach ($languages as $key=>$value) {
|
||||
if ($translation) {
|
||||
$output .= "<a href=\"admin.php?mod=locale&op=translated&language=$key\">translated '$key' strings</a> | ";
|
||||
$output .= la(t("translated '$key' strings"), array("mod" => "locale", "op" => "translated", "language" => $key))." | ";
|
||||
}
|
||||
else {
|
||||
$output .= "<a href=\"admin.php?mod=locale&op=untranslated&language=$key\">untranslated '$key' strings</a> | ";
|
||||
$output .= la(t("untranslated '$key' strings"), array("mod" => "locale", "op" => "untranslated", "language" => $key))." | ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ function locale_seek() {
|
|||
$output .= "<td align=\"center\">". check_output(locale_languages($locale)) ."</td>";
|
||||
}
|
||||
|
||||
$output .= "<td nowrap=\"nowrap\"><a href=\"admin.php?mod=locale&op=edit&id=$locale->lid\">edit locale</a></td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=locale&op=delete&id=$locale->lid\">delete locale</a></td></tr>";
|
||||
$output .= "<td nowrap=\"nowrap\">".la(t("edit locale"), array("mod" => "locale", "op" => "edit", "id" => $locale->lid))."</td><td nowrap=\"nowrap\">".la(t("delete locale"), array("mod" => "locale", "op" => "delete", "id" => $locale->lid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>\n";
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ function locale_admin() {
|
|||
print status("locale disabled.");
|
||||
}
|
||||
else if (user_access("administer locales")) {
|
||||
print "<small>". locale_links(1) . locale_links(0) ."<a href=\"admin.php?mod=locale&op=Search\">search</a> | <a href=\"admin.php?mod=locale&op=overview\">overview</a> | <a href=\"admin.php?mod=locale&op=help\">help</a></small><hr />\n";
|
||||
print "<small>". locale_links(1) . locale_links(0) .la(t("search"), array("mod" => "locale", "op" => "Search"))." | ".la(t("overview"), array("mod" => "locale", "op" => "overview"))." | ".la(t("help"), array("mod" => "locale", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "delete":
|
||||
|
@ -266,9 +266,9 @@ function locale($string) {
|
|||
$string = check_output($locale_t[$string]);
|
||||
}
|
||||
else {
|
||||
$result = db_query("SELECT lid, $locale FROM locales WHERE STRCMP(string, '". addslashes($string) ."') = 0");
|
||||
$result = db_query("SELECT lid, $locale FROM locales WHERE string = '%s'", $string);
|
||||
if (!db_fetch_object($result)) {
|
||||
db_query("INSERT INTO locales (string, location) VALUES ('". check_query($string) ."', '". check_query(getenv("REQUEST_URI")) ."')");
|
||||
db_query("INSERT INTO locales (string, location) VALUES ('%s', '%s')", $string, getenv("PATH_INFO"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ function node_filter_line($text) {
|
|||
}
|
||||
|
||||
function node_comment_mode($nid) {
|
||||
return db_result(db_query("SELECT comment FROM node WHERE nid = '".check_query($nid)."'"));
|
||||
return db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
|
||||
}
|
||||
|
||||
function node_filter($text) {
|
||||
|
@ -376,11 +376,11 @@ function node_filter($text) {
|
|||
function node_link($type, $node = 0, $main = 0) {
|
||||
|
||||
if ($type == "admin" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node\">content management</a>";
|
||||
$links[] = la(t("content management"), array("mod" => "node"));
|
||||
}
|
||||
|
||||
if ($type == "page" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add\" title=\"". t("Submit or suggest new content.") ."\">". t("submit") ."</a>";
|
||||
$links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), t("Submit or suggest new content."));
|
||||
}
|
||||
|
||||
if ($type == "node") {
|
||||
|
@ -389,11 +389,11 @@ function node_link($type, $node = 0, $main = 0) {
|
|||
}
|
||||
|
||||
if ($main == 1 && $node->teaser != $node->body) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid\" title=\"". t("Read the rest of this posting.") ."\">". t("read more") ."</a>";
|
||||
$links[] = l(t("read more"), array("id" => $node->nid), t("Read the rest of this posting."));
|
||||
}
|
||||
|
||||
if (user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Administer this node.") ."\">". t("administer") ."</a>";
|
||||
$links[] = la(t("administer"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Administer this node."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ function node_admin_edit($node) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>older revisions</th><th colspan=\"3\">operations</th></tr>";
|
||||
foreach ($node->revisions as $key => $revision) {
|
||||
$output .= " <tr><td>". strtr(t("revision #%r revised by %u on %d"), array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td><a href=\"node.php?id=$node->nid&revision=$key\">". t("view revision") ."</a></td><td><a href=\"admin.php?mod=node&op=rollback+revision&id=$node->nid&revision=$key\">". t("rollback revision") ."</a></td><td><a href=\"admin.php?mod=node&op=delete+revision&id=$node->nid&revision=$key\">". t("delete revision") ."</a></td></tr>";
|
||||
$output .= " <tr><td>". t("revision #%r revised by %u on %d", array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td>".l(t("view revision"), array("id" => $node->nid, "revision" =>$key))."</td><td>".la(t("rollback revision"), array("mod" => "node", "op" => "rollback+revision", "id" => $node->nid, "revision" => $key))."</td><td>". la(t("delete revision"), array("mod" => "node", "op" => "delete+revision", "id" => $node->nid, "revision" => $key))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ function node_admin_nodes() {
|
|||
$result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0] ." LIMIT 50");
|
||||
|
||||
foreach ($queries as $key => $value) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=nodes&query=$key\">$value[1]</a>";
|
||||
$links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key));
|
||||
}
|
||||
|
||||
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
|
||||
|
@ -495,7 +495,7 @@ function node_admin_nodes() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>type</th><th>author</th><th>status</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit node") ."</a></td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete node") ."</a></td></tr>";
|
||||
$output .= "<tr><td>".l(check_output($node->title), array("id" => $node->nid))."</td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td><td nowrap=\"nowrap\">".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
@ -611,10 +611,10 @@ function node_admin() {
|
|||
** Compile a list of the administrative links:
|
||||
*/
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=nodes\">nodes</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=search\">search content</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=settings\">settings</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=help\">help</a>";
|
||||
$links[] = la(t("nodes"), array("mod" => "node", "op" => "nodes"));
|
||||
$links[] = la(t("search content"), array("mod" => "node", "op" => "search"));
|
||||
$links[] = la(t("settings"), array("mod" => "node", "op" => "settings"));
|
||||
$links[] = la(t("help"), array("mod" => "node", "op" => "help"));
|
||||
|
||||
print "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -623,7 +623,7 @@ function node_admin() {
|
|||
print node_help();
|
||||
break;
|
||||
case "search":
|
||||
print search_type("node", "admin.php?mod=node&op=search");
|
||||
print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin"));
|
||||
break;
|
||||
case t("Save configuration"):
|
||||
case t("Reset to defaults"):
|
||||
|
@ -666,7 +666,7 @@ function node_block() {
|
|||
global $theme;
|
||||
|
||||
$block[0][subject] = t("Syndicate");
|
||||
$block[0][content] = "<div align=\"center\"><a href=\"module.php?mod=node&op=feed\" title=\"". t("Read the XML version of this page.")."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" /></a></div>\n";
|
||||
$block[0][content] = "<div align=\"center\">".lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), t("Read the XML version of this page."))."</div>\n";
|
||||
$block[0][info] = "Syndicate";
|
||||
|
||||
return $block;
|
||||
|
@ -679,7 +679,7 @@ function node_feed() {
|
|||
while ($node = db_fetch_object($result)) {
|
||||
$item = node_load(array("nid" => $node->nid, "type" => $node->type));
|
||||
|
||||
$link = path_uri() ."node.php?id=$item->nid";
|
||||
$link = path_uri() .drupal_url(array("id" => $item->nid), "node");
|
||||
|
||||
$items .= format_rss_item($item->title, $link, $item->teaser);
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ function node_validate($node, &$error) {
|
|||
$node->uid = $account->uid;
|
||||
}
|
||||
else {
|
||||
$error["name"] = "<div style=\"color: red;\">". strtr(t("The name '%u' does not exist."), array ("%u" => $node->name)) ."</div>";
|
||||
$error["name"] = "<div style=\"color: red;\">". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."</div>";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -902,7 +902,7 @@ function node_add($type) {
|
|||
foreach (module_list() as $name) {
|
||||
if (module_hook($name, "node") && node_access("create", array("type" => $name))) {
|
||||
$output .= "<li>";
|
||||
$output .= " <a href=\"module.php?mod=node&op=add&type=$name\" title=\"". strtr(t("Add a new %s."), array("%s" => module_invoke($name, "node", "name"))) ."\">". module_invoke($name, "node", "name") ."</a>";
|
||||
$output .= " ".lm(module_invoke($name, "node", "name"), array("mod" => "node", "op" => "add", "type" => $name), t("Add a new %s.", array("%s" => module_invoke($name, "node", "name"))));
|
||||
$output .= " <div style=\"margin-left: 20px;\">". module_invoke($name, "node", "description") ."</div>";
|
||||
$output .= "</li>";
|
||||
}
|
||||
|
@ -1105,11 +1105,11 @@ function node_submit($node) {
|
|||
}
|
||||
|
||||
if ($nid && node_access("view", $node)) {
|
||||
$links[] = "<a href=\"node.php?id=$nid\">". t("view") ."</a>";
|
||||
$links[] = l(t("view"), array("id" => $nid));
|
||||
}
|
||||
|
||||
if ($nid && node_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$nid\">". t("edit") ."</a>";
|
||||
$links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid));
|
||||
}
|
||||
|
||||
$output .= "<p>". $theme->links($links) ."</p>";
|
||||
|
|
|
@ -364,7 +364,7 @@ function node_filter_line($text) {
|
|||
}
|
||||
|
||||
function node_comment_mode($nid) {
|
||||
return db_result(db_query("SELECT comment FROM node WHERE nid = '".check_query($nid)."'"));
|
||||
return db_result(db_query("SELECT comment FROM node WHERE nid = '%s'", $nid));
|
||||
}
|
||||
|
||||
function node_filter($text) {
|
||||
|
@ -376,11 +376,11 @@ function node_filter($text) {
|
|||
function node_link($type, $node = 0, $main = 0) {
|
||||
|
||||
if ($type == "admin" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node\">content management</a>";
|
||||
$links[] = la(t("content management"), array("mod" => "node"));
|
||||
}
|
||||
|
||||
if ($type == "page" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add\" title=\"". t("Submit or suggest new content.") ."\">". t("submit") ."</a>";
|
||||
$links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), t("Submit or suggest new content."));
|
||||
}
|
||||
|
||||
if ($type == "node") {
|
||||
|
@ -389,11 +389,11 @@ function node_link($type, $node = 0, $main = 0) {
|
|||
}
|
||||
|
||||
if ($main == 1 && $node->teaser != $node->body) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid\" title=\"". t("Read the rest of this posting.") ."\">". t("read more") ."</a>";
|
||||
$links[] = l(t("read more"), array("id" => $node->nid), t("Read the rest of this posting."));
|
||||
}
|
||||
|
||||
if (user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=$node->nid\" title=\"". t("Administer this node.") ."\">". t("administer") ."</a>";
|
||||
$links[] = la(t("administer"), array("mod" => "node", "op" => "edit", "id" => $node->nid), t("Administer this node."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ function node_admin_edit($node) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>older revisions</th><th colspan=\"3\">operations</th></tr>";
|
||||
foreach ($node->revisions as $key => $revision) {
|
||||
$output .= " <tr><td>". strtr(t("revision #%r revised by %u on %d"), array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td><a href=\"node.php?id=$node->nid&revision=$key\">". t("view revision") ."</a></td><td><a href=\"admin.php?mod=node&op=rollback+revision&id=$node->nid&revision=$key\">". t("rollback revision") ."</a></td><td><a href=\"admin.php?mod=node&op=delete+revision&id=$node->nid&revision=$key\">". t("delete revision") ."</a></td></tr>";
|
||||
$output .= " <tr><td>". t("revision #%r revised by %u on %d", array("%r" => $key, "%u" => format_name(user_load(array("uid" => $revision["uid"]))), "%d" => format_date($revision["timestamp"], "small"))) . ($revision["history"] ? "<br /><small>". $revision["history"] ."</small>" : "") ."</td><td>".l(t("view revision"), array("id" => $node->nid, "revision" =>$key))."</td><td>".la(t("rollback revision"), array("mod" => "node", "op" => "rollback+revision", "id" => $node->nid, "revision" => $key))."</td><td>". la(t("delete revision"), array("mod" => "node", "op" => "delete+revision", "id" => $node->nid, "revision" => $key))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ function node_admin_nodes() {
|
|||
$result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0] ." LIMIT 50");
|
||||
|
||||
foreach ($queries as $key => $value) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=nodes&query=$key\">$value[1]</a>";
|
||||
$links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key));
|
||||
}
|
||||
|
||||
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
|
||||
|
@ -495,7 +495,7 @@ function node_admin_nodes() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>title</th><th>type</th><th>author</th><th>status</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("edit node") ."</a></td><td nowrap=\"nowrap\"><a href=\"admin.php?mod=node&op=delete&id=$node->nid\">". t("delete node") ."</a></td></tr>";
|
||||
$output .= "<tr><td>".l(check_output($node->title), array("id" => $node->nid))."</td><td>$node->type</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">".la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid))."</td><td nowrap=\"nowrap\">".la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
@ -611,10 +611,10 @@ function node_admin() {
|
|||
** Compile a list of the administrative links:
|
||||
*/
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=nodes\">nodes</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=search\">search content</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=settings\">settings</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=help\">help</a>";
|
||||
$links[] = la(t("nodes"), array("mod" => "node", "op" => "nodes"));
|
||||
$links[] = la(t("search content"), array("mod" => "node", "op" => "search"));
|
||||
$links[] = la(t("settings"), array("mod" => "node", "op" => "settings"));
|
||||
$links[] = la(t("help"), array("mod" => "node", "op" => "help"));
|
||||
|
||||
print "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -623,7 +623,7 @@ function node_admin() {
|
|||
print node_help();
|
||||
break;
|
||||
case "search":
|
||||
print search_type("node", "admin.php?mod=node&op=search");
|
||||
print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin"));
|
||||
break;
|
||||
case t("Save configuration"):
|
||||
case t("Reset to defaults"):
|
||||
|
@ -666,7 +666,7 @@ function node_block() {
|
|||
global $theme;
|
||||
|
||||
$block[0][subject] = t("Syndicate");
|
||||
$block[0][content] = "<div align=\"center\"><a href=\"module.php?mod=node&op=feed\" title=\"". t("Read the XML version of this page.")."\"><img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" /></a></div>\n";
|
||||
$block[0][content] = "<div align=\"center\">".lm("<img src=\"". $theme->image("xml.gif") ."\" width=\"36\" height=\"14\" border=\"0\" alt=\"XML\" />", array("mod" => "node", "op" => "feed"), t("Read the XML version of this page."))."</div>\n";
|
||||
$block[0][info] = "Syndicate";
|
||||
|
||||
return $block;
|
||||
|
@ -679,7 +679,7 @@ function node_feed() {
|
|||
while ($node = db_fetch_object($result)) {
|
||||
$item = node_load(array("nid" => $node->nid, "type" => $node->type));
|
||||
|
||||
$link = path_uri() ."node.php?id=$item->nid";
|
||||
$link = path_uri() .drupal_url(array("id" => $item->nid), "node");
|
||||
|
||||
$items .= format_rss_item($item->title, $link, $item->teaser);
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ function node_validate($node, &$error) {
|
|||
$node->uid = $account->uid;
|
||||
}
|
||||
else {
|
||||
$error["name"] = "<div style=\"color: red;\">". strtr(t("The name '%u' does not exist."), array ("%u" => $node->name)) ."</div>";
|
||||
$error["name"] = "<div style=\"color: red;\">". t("The name '%u' does not exist.", array ("%u" => $node->name)) ."</div>";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -902,7 +902,7 @@ function node_add($type) {
|
|||
foreach (module_list() as $name) {
|
||||
if (module_hook($name, "node") && node_access("create", array("type" => $name))) {
|
||||
$output .= "<li>";
|
||||
$output .= " <a href=\"module.php?mod=node&op=add&type=$name\" title=\"". strtr(t("Add a new %s."), array("%s" => module_invoke($name, "node", "name"))) ."\">". module_invoke($name, "node", "name") ."</a>";
|
||||
$output .= " ".lm(module_invoke($name, "node", "name"), array("mod" => "node", "op" => "add", "type" => $name), t("Add a new %s.", array("%s" => module_invoke($name, "node", "name"))));
|
||||
$output .= " <div style=\"margin-left: 20px;\">". module_invoke($name, "node", "description") ."</div>";
|
||||
$output .= "</li>";
|
||||
}
|
||||
|
@ -1105,11 +1105,11 @@ function node_submit($node) {
|
|||
}
|
||||
|
||||
if ($nid && node_access("view", $node)) {
|
||||
$links[] = "<a href=\"node.php?id=$nid\">". t("view") ."</a>";
|
||||
$links[] = l(t("view"), array("id" => $nid));
|
||||
}
|
||||
|
||||
if ($nid && node_access("update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$nid\">". t("edit") ."</a>";
|
||||
$links[] = lm(t("edit"), array("mod" => "node", "op" => "edit", "id" => $nid));
|
||||
}
|
||||
|
||||
$output .= "<p>". $theme->links($links) ."</p>";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// $Id$
|
||||
|
||||
function page_help() {
|
||||
$output .= "<p>The page module is used to create a <i>site page</i>. Unlike a story, a site page is a persistent web page on your site which usually shortcuts the typical lifecycle of user generated content (i.e. submit -> moderate -> post -> comment). A site page is usually linked from the main navigation bar, using whatever text the author wishes. To create a site page without this navigation link, simply skip the form field which requests link text. Administrators are the exclusive authors of site pages (i.e. requires the <i>adinister nodes</i> in <a href=\"/admin.php?mod=user&op=permission\">permission</a>).</p>";
|
||||
$output .= "<p>The page module is used to create a <i>site page</i>. Unlike a story, a site page is a persistent web page on your site which usually shortcuts the typical lifecycle of user generated content (i.e. submit -> moderate -> post -> comment). A site page is usually linked from the main navigation bar, using whatever text the author wishes. To create a site page without this navigation link, simply skip the form field which requests link text. Administrators are the exclusive authors of site pages (i.e. requires the <i>adinister nodes</i> in ".la("permission", array("mod" => "user", "op" => "permission")).").</p>";
|
||||
$output .= "<p>Site pages, unlike many other forms of Drupal content, may be made of PHP code in addition to HTML and text. All Drupal objects and functions are available to the Site Page author.</p>";
|
||||
return $output;
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ function page_link($type) {
|
|||
if ($type == "page") {
|
||||
$result = db_query("SELECT n.nid, p.link FROM page p LEFT JOIN node n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
|
||||
while ($page = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"node.php?id=$page->nid\">$page->link</a>";
|
||||
$links[] = l($page->link, array("id" => $page->nid));
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=page\" title=\"". t("Add a new site page.") ."\">". t("create site page") ."</a>";
|
||||
$links[] = lm(t("create site page"), array("mod" => "node", "op" => "add", "type" => "page"), t("Add a new site page."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// $Id$
|
||||
|
||||
function page_help() {
|
||||
$output .= "<p>The page module is used to create a <i>site page</i>. Unlike a story, a site page is a persistent web page on your site which usually shortcuts the typical lifecycle of user generated content (i.e. submit -> moderate -> post -> comment). A site page is usually linked from the main navigation bar, using whatever text the author wishes. To create a site page without this navigation link, simply skip the form field which requests link text. Administrators are the exclusive authors of site pages (i.e. requires the <i>adinister nodes</i> in <a href=\"/admin.php?mod=user&op=permission\">permission</a>).</p>";
|
||||
$output .= "<p>The page module is used to create a <i>site page</i>. Unlike a story, a site page is a persistent web page on your site which usually shortcuts the typical lifecycle of user generated content (i.e. submit -> moderate -> post -> comment). A site page is usually linked from the main navigation bar, using whatever text the author wishes. To create a site page without this navigation link, simply skip the form field which requests link text. Administrators are the exclusive authors of site pages (i.e. requires the <i>adinister nodes</i> in ".la("permission", array("mod" => "user", "op" => "permission")).").</p>";
|
||||
$output .= "<p>Site pages, unlike many other forms of Drupal content, may be made of PHP code in addition to HTML and text. All Drupal objects and functions are available to the Site Page author.</p>";
|
||||
return $output;
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ function page_link($type) {
|
|||
if ($type == "page") {
|
||||
$result = db_query("SELECT n.nid, p.link FROM page p LEFT JOIN node n ON p.nid = n.nid WHERE n.status = '1' AND p.link != '' ORDER BY p.link");
|
||||
while ($page = db_fetch_object($result)) {
|
||||
$links[] = "<a href=\"node.php?id=$page->nid\">$page->link</a>";
|
||||
$links[] = l($page->link, array("id" => $page->nid));
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == "menu.create" && user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=page\" title=\"". t("Add a new site page.") ."\">". t("create site page") ."</a>";
|
||||
$links[] = lm(t("create site page"), array("mod" => "node", "op" => "add", "type" => "page"), t("Add a new site page."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -20,7 +20,7 @@ function poll_block() {
|
|||
poll_view($poll, 0, 1);
|
||||
}
|
||||
}
|
||||
$blocks[0][subject] = strtr(t("Latest poll: %t"), array("%t" => $poll->title));
|
||||
$blocks[0][subject] = t("Latest poll: %t", array("%t" => $poll->title));
|
||||
$blocks[0][content] = $poll->body;
|
||||
$blocks[0][info] = t("Most recent poll");
|
||||
return $blocks;
|
||||
|
@ -76,7 +76,7 @@ function poll_form(&$node, &$help, &$error) {
|
|||
for ($a = 0; $a < $node->choices; $a++) {
|
||||
$output .= form_textfield(t("Choice"). " " . ($a + 1), "choice][$a", $node->choice[$a], 50, 127, $error["choice][$a"]);
|
||||
if ($admin) {
|
||||
$output .= form_textfield(strtr(t("Votes for choice %n"), array("%n" => ($a + 1))), "chvotes][$a", $node->chvotes[$a] ? $node->chvotes[$a] : 0, 7, 7, $error["chvotes][$a"]);
|
||||
$output .= form_textfield(t("Votes for choice %n", array("%n" => ($a + 1))), "chvotes][$a", $node->chvotes[$a] ? $node->chvotes[$a] : 0, 7, 7, $error["chvotes][$a"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ function poll_insert($node) {
|
|||
|
||||
function poll_link($type) {
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=poll\" title=\"". t("Add a new poll.") ."\">". t("create poll") ."</a>";
|
||||
$links[] = lm(t("create poll"), array("mod" => "node", "op" => "add", "type" => "poll"), t("Add a new poll."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -184,7 +184,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
|
|||
|
||||
/* When a poll is displayed twice on the same page (e.g. on the front page and in the side bar)
|
||||
we only want to vote on one of them. We keep count using $pollid */
|
||||
global $pollidcount, $pollvote, $pollid, $REMOTE_ADDR, $REQUEST_URI;
|
||||
global $pollidcount, $pollvote, $pollid, $REMOTE_ADDR;
|
||||
$pollidcount++;
|
||||
|
||||
// Only accept votes on specific cases to prevent double voting
|
||||
|
@ -215,7 +215,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
|
|||
|
||||
if ($allowvotes) {
|
||||
// Display the vote form
|
||||
$url = $REQUEST_URI . (strstr($REQUEST_URI, "?") ? "&" : "?") . "pollid=" . $pollidcount;
|
||||
$url = request_uri() . (strstr(request_uri(), "?") ? "&" : "?") . "pollid=" . $pollidcount;
|
||||
$output .= "<form action=\"$url\" method=\"post\">";
|
||||
$output .= "<table border=\"0\" align=\"center\"><tr><td>";
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function poll_block() {
|
|||
poll_view($poll, 0, 1);
|
||||
}
|
||||
}
|
||||
$blocks[0][subject] = strtr(t("Latest poll: %t"), array("%t" => $poll->title));
|
||||
$blocks[0][subject] = t("Latest poll: %t", array("%t" => $poll->title));
|
||||
$blocks[0][content] = $poll->body;
|
||||
$blocks[0][info] = t("Most recent poll");
|
||||
return $blocks;
|
||||
|
@ -76,7 +76,7 @@ function poll_form(&$node, &$help, &$error) {
|
|||
for ($a = 0; $a < $node->choices; $a++) {
|
||||
$output .= form_textfield(t("Choice"). " " . ($a + 1), "choice][$a", $node->choice[$a], 50, 127, $error["choice][$a"]);
|
||||
if ($admin) {
|
||||
$output .= form_textfield(strtr(t("Votes for choice %n"), array("%n" => ($a + 1))), "chvotes][$a", $node->chvotes[$a] ? $node->chvotes[$a] : 0, 7, 7, $error["chvotes][$a"]);
|
||||
$output .= form_textfield(t("Votes for choice %n", array("%n" => ($a + 1))), "chvotes][$a", $node->chvotes[$a] ? $node->chvotes[$a] : 0, 7, 7, $error["chvotes][$a"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ function poll_insert($node) {
|
|||
|
||||
function poll_link($type) {
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=poll\" title=\"". t("Add a new poll.") ."\">". t("create poll") ."</a>";
|
||||
$links[] = lm(t("create poll"), array("mod" => "node", "op" => "add", "type" => "poll"), t("Add a new poll."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -184,7 +184,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
|
|||
|
||||
/* When a poll is displayed twice on the same page (e.g. on the front page and in the side bar)
|
||||
we only want to vote on one of them. We keep count using $pollid */
|
||||
global $pollidcount, $pollvote, $pollid, $REMOTE_ADDR, $REQUEST_URI;
|
||||
global $pollidcount, $pollvote, $pollid, $REMOTE_ADDR;
|
||||
$pollidcount++;
|
||||
|
||||
// Only accept votes on specific cases to prevent double voting
|
||||
|
@ -215,7 +215,7 @@ function poll_view(&$node, $main = 0, $block = 0) {
|
|||
|
||||
if ($allowvotes) {
|
||||
// Display the vote form
|
||||
$url = $REQUEST_URI . (strstr($REQUEST_URI, "?") ? "&" : "?") . "pollid=" . $pollidcount;
|
||||
$url = request_uri() . (strstr(request_uri(), "?") ? "&" : "?") . "pollid=" . $pollidcount;
|
||||
$output .= "<form action=\"$url\" method=\"post\">";
|
||||
$output .= "<table border=\"0\" align=\"center\"><tr><td>";
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ function queue_perm() {
|
|||
|
||||
function queue_link($type) {
|
||||
if ($type == "menu.view" && user_access("access submission queue")) {
|
||||
$links[] = "<a href=\"module.php?mod=queue\" title=\"". t("Moderate the content in the submission queue.") ."\">". t("view submissions") ."</a> (<span style=\"color: red;\">". queue_count() ."</span>)";
|
||||
$links[] = la(t("view submissions"), array("mod" => "queue"), t("Moderate the content in the submission queue."))." (<span style=\"color: red;\">". queue_count() ."</span>)";
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -84,10 +84,10 @@ function queue_overview() {
|
|||
$output .= " <tr><th>". t("Subject") ."</th><th>". t("Author") ."</th><th>". t("Type") ."</th><th>". t("Score") ."</th></tr>";
|
||||
while ($node = db_fetch_object($result)) {
|
||||
if ($user->uid == $node->uid || field_get($node->users, $user->uid)) {
|
||||
$output .= " <tr><td><a href=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</a></td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". queue_score($node->nid) ."</td></tr>";
|
||||
$output .= " <tr><td>".la(check_output($node->title), array("mod" => "queue", "op" => "view", "id" => $node->nid))."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">". queue_score($node->nid) ."</td></tr>";
|
||||
}
|
||||
else {
|
||||
$output .= " <tr><td><a href=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</a></td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\"><a href=\"module.php?mod=queue&op=view&id=$node->nid\">". t("vote") ."</a></td></tr>";
|
||||
$output .= " <tr><td>".lm(check_output($node->title), array("mod" => "queue", "op" => "view", "id" => $node->nid))."</td><td align=\"center\">". format_name($node) ."</td><td align=\"center\">". module_invoke($node->type, "node", "name") ."</td><td align=\"center\">".lm(t("vote"), array("mod" => "queue", "op" => "view", "id" => $node->nid))."</td></tr>";
|
||||
}
|
||||
|
||||
if ($node->teaser) {
|
||||
|
|
|
@ -14,7 +14,7 @@ function rating_perm() {
|
|||
|
||||
function rating_link($type) {
|
||||
if ($type == "page" && user_access("access user ratings")) {
|
||||
$links[] = "<a href=\"module.php?mod=rating\" title=\"". t("Display an overview of the user ratings.") ."\">". t("user ratings") ."</a>";
|
||||
$links[] = lm(t("user ratings"), array("mod" => "rating"), t("Display an overview of the user ratings."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -29,11 +29,11 @@ function search_perm() {
|
|||
*/
|
||||
function search_link($type) {
|
||||
if ($type == "page" && user_access("search content")) {
|
||||
$links[] = "<a href=\"module.php?mod=search\" title=\"". t("Search for older content.") ."\">". t("search") ."</a>";
|
||||
$links[] = lm(t("search"), array("mod" => "search"), t("Search for older content."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer search")) {
|
||||
$links[] = "<a href=\"admin.php?mod=search\">". t("search") ."</a>";
|
||||
$links[] = la(t("search"), array("mod" => "search"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -193,10 +193,10 @@ function do_search($search_array) {
|
|||
}
|
||||
switch ($type) {
|
||||
case "node":
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=node&op=edit&id=$lno" : "node.php?id=$lno"), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "node", "type" => "node", "op" => "edit", "id" => $lno), "admin") : drupal_url(array("id" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
break;
|
||||
case "comment":
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$lno" : "node.php?id=$nid&cid=$lno"), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "comment", "op" => "edit", "id" =>$lno), "admin") : drupal_url(array("id" => $nid, "cid" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ function search_display($edit) {
|
|||
$form .= form_select(t("Help text position"), "help_pos", $edit["help_pos"], array("1" => t("Above search form"), "2" => t("Below search form"), "3" => t("Link from above search form"), "4" => t("Link from below search form")));
|
||||
$form .= form_submit("Submit");
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=search&op=reindex\">reindex all</a>";
|
||||
$links[] = la(t("reindex all"), array("mod" => "search", "op" => "reindex"));
|
||||
|
||||
$output = "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -377,7 +377,7 @@ function search_view() {
|
|||
** Display form and search results:
|
||||
*/
|
||||
|
||||
$help_link = "<a href=\"module.php?mod=search&op=help\">search help</a>";
|
||||
$help_link = lm(t("search help"), array("mod" => "search", "op" => "help"));
|
||||
switch (variable_get("help_pos", 1)) {
|
||||
case "1":
|
||||
$form = search_help(). $form;
|
||||
|
|
|
@ -29,11 +29,11 @@ function search_perm() {
|
|||
*/
|
||||
function search_link($type) {
|
||||
if ($type == "page" && user_access("search content")) {
|
||||
$links[] = "<a href=\"module.php?mod=search\" title=\"". t("Search for older content.") ."\">". t("search") ."</a>";
|
||||
$links[] = lm(t("search"), array("mod" => "search"), t("Search for older content."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer search")) {
|
||||
$links[] = "<a href=\"admin.php?mod=search\">". t("search") ."</a>";
|
||||
$links[] = la(t("search"), array("mod" => "search"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -193,10 +193,10 @@ function do_search($search_array) {
|
|||
}
|
||||
switch ($type) {
|
||||
case "node":
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=node&type=node&op=edit&id=$lno" : "node.php?id=$lno"), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "node", "type" => "node", "op" => "edit", "id" => $lno), "admin") : drupal_url(array("id" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
break;
|
||||
case "comment":
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=comment&op=edit&id=$lno" : "node.php?id=$nid&cid=$lno"), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
$find[$i++] = array("count" => $count, "title" => check_output($title), "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "comment", "op" => "edit", "id" =>$lno), "admin") : drupal_url(array("id" => $nid, "cid" => $lno))), "user" => $name, "date" => $created, "keywords" => implode("|", $words));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ function search_display($edit) {
|
|||
$form .= form_select(t("Help text position"), "help_pos", $edit["help_pos"], array("1" => t("Above search form"), "2" => t("Below search form"), "3" => t("Link from above search form"), "4" => t("Link from below search form")));
|
||||
$form .= form_submit("Submit");
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=search&op=reindex\">reindex all</a>";
|
||||
$links[] = la(t("reindex all"), array("mod" => "search", "op" => "reindex"));
|
||||
|
||||
$output = "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -377,7 +377,7 @@ function search_view() {
|
|||
** Display form and search results:
|
||||
*/
|
||||
|
||||
$help_link = "<a href=\"module.php?mod=search&op=help\">search help</a>";
|
||||
$help_link = lm(t("search help"), array("mod" => "search", "op" => "help"));
|
||||
switch (variable_get("help_pos", 1)) {
|
||||
case "1":
|
||||
$form = search_help(). $form;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// $Id$
|
||||
|
||||
if (variable_get("referrer", 0) && $referrer = getenv("HTTP_REFERER")) {
|
||||
db_query("INSERT INTO referrer (URL, timestamp) values ('". check_input($referrer) ."', '". time() ."')");
|
||||
db_query("INSERT INTO referrer (URL, timestamp) values ('%s', '%s')", $referrer, time());
|
||||
}
|
||||
|
||||
function statistics_help() {
|
||||
|
@ -24,7 +24,7 @@ function statistics_perm() {
|
|||
|
||||
function statistics_link($type) {
|
||||
if ($type == "admin" && user_access("administer statistics")) {
|
||||
$links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>";
|
||||
$links[] = la(t("statistics"), array("mod" => "statistics"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -92,7 +92,7 @@ function statistics_admin() {
|
|||
|
||||
if (user_access("administer statistics")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=statistics&type=internal+referrer\">internal referrers</a> | <a href=\"admin.php?mod=statistics&type=external+referrer\">external referrers</a> | <a href=\"admin.php?mod=statistics&op=help\">help</a></small><hr />\n";
|
||||
print "<small>".la(t("internal referrers"), array("mod" => "statistics", "type" => "internal+referrer"))." | ".la(t("external referrers"), array("mod" => "statistics", "type" => "external+referrer"))." | ".la(t("help"), array("mod" => "statistics", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// $Id$
|
||||
|
||||
if (variable_get("referrer", 0) && $referrer = getenv("HTTP_REFERER")) {
|
||||
db_query("INSERT INTO referrer (URL, timestamp) values ('". check_input($referrer) ."', '". time() ."')");
|
||||
db_query("INSERT INTO referrer (URL, timestamp) values ('%s', '%s')", $referrer, time());
|
||||
}
|
||||
|
||||
function statistics_help() {
|
||||
|
@ -24,7 +24,7 @@ function statistics_perm() {
|
|||
|
||||
function statistics_link($type) {
|
||||
if ($type == "admin" && user_access("administer statistics")) {
|
||||
$links[] = "<a href=\"admin.php?mod=statistics\">statistics</a>";
|
||||
$links[] = la(t("statistics"), array("mod" => "statistics"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -92,7 +92,7 @@ function statistics_admin() {
|
|||
|
||||
if (user_access("administer statistics")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=statistics&type=internal+referrer\">internal referrers</a> | <a href=\"admin.php?mod=statistics&type=external+referrer\">external referrers</a> | <a href=\"admin.php?mod=statistics&op=help\">help</a></small><hr />\n";
|
||||
print "<small>".la(t("internal referrers"), array("mod" => "statistics", "type" => "internal+referrer"))." | ".la(t("external referrers"), array("mod" => "statistics", "type" => "external+referrer"))." | ".la(t("help"), array("mod" => "statistics", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
|
|
@ -57,7 +57,7 @@ function story_save($op, $node) {
|
|||
|
||||
function story_link($type) {
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=story\" title=\"". t("Add a new story.") ."\">". t("create story") ."</a>";
|
||||
$links[] = lm(t("create story"), array("mod" => "node", "op" => "add", "type" => "story"), t("Add a new story."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -57,7 +57,7 @@ function story_save($op, $node) {
|
|||
|
||||
function story_link($type) {
|
||||
if ($type == "menu.create" && user_access("post content")) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=add&type=story\" title=\"". t("Add a new story.") ."\">". t("create story") ."</a>";
|
||||
$links[] = lm(t("create story"), array("mod" => "node", "op" => "add", "type" => "story"), t("Add a new story."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
|
|
@ -29,11 +29,11 @@ function system_perm() {
|
|||
|
||||
function system_link($type) {
|
||||
if ($type == "admin" && user_access("administer settings and filters")) {
|
||||
$links[] = "<a href=\"admin.php?mod=system\">settings and filters</a>";
|
||||
$links[] = la(t("settings and filters"), array("mod" => "system"));
|
||||
}
|
||||
|
||||
/*if ($type == "admin" && user_access("administer modules and themes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=system&op=modules\">modules and themes</a>";
|
||||
$links[] = la(t("modules and themes"), array("mod" => "system", "op" => "modules"));
|
||||
}*/
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -164,7 +164,7 @@ function system_modules() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>module</th><th>description</th><th>status</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
foreach ($modules as $name => $module) {
|
||||
$output .= " <tr><td>$name</td><td>". check_output(module_invoke($name, "system", "description")) ."</td><td>". (in_array($name, $required) ? "Enabled" : form_select("", "status][$name", $module["status"], array(t("Disabled"), t("Enabled")))) ."</td><td>". (module_hook($name, "page") ? "<a href=\"module.php?mod=$name\">view</a>" : " ") ."</td><td>". (module_hook($name, "admin") ? "<a href=\"admin.php?mod=$name\">admin</a>" : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td>$name</td><td>". check_output(module_invoke($name, "system", "description")) ."</td><td>". (in_array($name, $required) ? "Enabled" : form_select("", "status][$name", $module["status"], array(t("Disabled"), t("Enabled")))) ."</td><td>". (module_hook($name, "page") ? lm(t("view"), array("mod" => $name)) : " ") ."</td><td>". (module_hook($name, "admin") ? la(t("admin"), array("mod" => $name)) : " ") ."</td></tr>\n";
|
||||
if (!in_array($name, $required)) {
|
||||
db_query("INSERT INTO system SET name = '$name', type = 'module', filename = '$module[filename]', status = '$module[status]'");
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ function system_admin() {
|
|||
global $edit, $op, $type;
|
||||
if (user_access("administer settings and filters")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=system&type=options\">site settings</a> | <a href=\"admin.php?mod=system&type=filter\">content filters</a> | <a href=\"admin.php?mod=system&op=modules\">modules</a> | <a href=\"admin.php?mod=system&op=themes\">themes</a> | <a href=\"admin.php?mod=system&op=help\">help</a></small><hr />\n";
|
||||
print "<small>".la(t("site settings"), array("mod" => "system", "type" => "options"))." | ".la(t("content filters"), array("mod" => "system", "type" => "filter"))." | ".la(t("modules"), array("mod" => "system", "op" => "modules"))." | ".la(t("themes"), array("mod" => "system", "op" => "themes"))." | ".la(t("help"), array("mod" => "system", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
@ -258,7 +258,7 @@ function system_admin() {
|
|||
break;
|
||||
case "Save theme settings":
|
||||
foreach ($edit as $name => $settings) {
|
||||
db_query("UPDATE system SET status = '". check_query($settings["status"]) ."', description = '". check_query($settings["description"]) ."' WHERE name = '$name'");
|
||||
db_query("UPDATE system SET status = '%s', description = '%s' WHERE name = '$name'", $settings["status"], $settings["description"]);
|
||||
}
|
||||
case "themes":
|
||||
print system_themes();
|
||||
|
|
|
@ -29,11 +29,11 @@ function system_perm() {
|
|||
|
||||
function system_link($type) {
|
||||
if ($type == "admin" && user_access("administer settings and filters")) {
|
||||
$links[] = "<a href=\"admin.php?mod=system\">settings and filters</a>";
|
||||
$links[] = la(t("settings and filters"), array("mod" => "system"));
|
||||
}
|
||||
|
||||
/*if ($type == "admin" && user_access("administer modules and themes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=system&op=modules\">modules and themes</a>";
|
||||
$links[] = la(t("modules and themes"), array("mod" => "system", "op" => "modules"));
|
||||
}*/
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -164,7 +164,7 @@ function system_modules() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
|
||||
$output .= " <tr><th>module</th><th>description</th><th>status</th><th colspan=\"2\">operations</th></tr>\n";
|
||||
foreach ($modules as $name => $module) {
|
||||
$output .= " <tr><td>$name</td><td>". check_output(module_invoke($name, "system", "description")) ."</td><td>". (in_array($name, $required) ? "Enabled" : form_select("", "status][$name", $module["status"], array(t("Disabled"), t("Enabled")))) ."</td><td>". (module_hook($name, "page") ? "<a href=\"module.php?mod=$name\">view</a>" : " ") ."</td><td>". (module_hook($name, "admin") ? "<a href=\"admin.php?mod=$name\">admin</a>" : " ") ."</td></tr>\n";
|
||||
$output .= " <tr><td>$name</td><td>". check_output(module_invoke($name, "system", "description")) ."</td><td>". (in_array($name, $required) ? "Enabled" : form_select("", "status][$name", $module["status"], array(t("Disabled"), t("Enabled")))) ."</td><td>". (module_hook($name, "page") ? lm(t("view"), array("mod" => $name)) : " ") ."</td><td>". (module_hook($name, "admin") ? la(t("admin"), array("mod" => $name)) : " ") ."</td></tr>\n";
|
||||
if (!in_array($name, $required)) {
|
||||
db_query("INSERT INTO system SET name = '$name', type = 'module', filename = '$module[filename]', status = '$module[status]'");
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ function system_admin() {
|
|||
global $edit, $op, $type;
|
||||
if (user_access("administer settings and filters")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=system&type=options\">site settings</a> | <a href=\"admin.php?mod=system&type=filter\">content filters</a> | <a href=\"admin.php?mod=system&op=modules\">modules</a> | <a href=\"admin.php?mod=system&op=themes\">themes</a> | <a href=\"admin.php?mod=system&op=help\">help</a></small><hr />\n";
|
||||
print "<small>".la(t("site settings"), array("mod" => "system", "type" => "options"))." | ".la(t("content filters"), array("mod" => "system", "type" => "filter"))." | ".la(t("modules"), array("mod" => "system", "op" => "modules"))." | ".la(t("themes"), array("mod" => "system", "op" => "themes"))." | ".la(t("help"), array("mod" => "system", "op" => "help"))."</small><hr />\n";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
@ -258,7 +258,7 @@ function system_admin() {
|
|||
break;
|
||||
case "Save theme settings":
|
||||
foreach ($edit as $name => $settings) {
|
||||
db_query("UPDATE system SET status = '". check_query($settings["status"]) ."', description = '". check_query($settings["description"]) ."' WHERE name = '$name'");
|
||||
db_query("UPDATE system SET status = '%s', description = '%s' WHERE name = '$name'", $settings["status"], $settings["description"]);
|
||||
}
|
||||
case "themes":
|
||||
print system_themes();
|
||||
|
|
|
@ -1,52 +1,50 @@
|
|||
<?php
|
||||
|
||||
function taxonomy_feed() {
|
||||
global $id, $or, $and, $type;
|
||||
|
||||
if ($type == "voc") {
|
||||
//TODO - vocabulary feed. How to represent an outline in XML?
|
||||
}
|
||||
else {
|
||||
if ($or) {
|
||||
foreach ((explode(",", $or)) as $t) {
|
||||
$terms[] = "'".check_query($t)."'";
|
||||
}
|
||||
$result = db_query("SELECT DISTINCT(n.nid), type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND status = '1' ORDER BY static DESC, created DESC LIMIT 15");
|
||||
$term = taxonomy_get_term($or);
|
||||
}
|
||||
else if ($and) {
|
||||
foreach ((explode(",", $and)) as $t) {
|
||||
$terms[] = "'".check_query($t)."'";
|
||||
}
|
||||
$result = db_query("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC LIMIT 15");
|
||||
$term = taxonomy_get_term($and);
|
||||
}
|
||||
else {
|
||||
return node_feed();
|
||||
}
|
||||
|
||||
$channel["title"] = variable_get("site_name", "drupal") . " - " . $term->name;
|
||||
$channel["link"] = path_uri() . "index.php?or=$or";
|
||||
$channel["description"] = $term->description;
|
||||
|
||||
node_feed($result, $channel);
|
||||
}
|
||||
}
|
||||
|
||||
function taxonomy_perm() {
|
||||
return array("administer taxonomy");
|
||||
}
|
||||
|
||||
function taxonomy_link($type) {
|
||||
if ($type == "admin" && user_access("administer taxonomy")) {
|
||||
$links[] = "<a href=\"admin.php?mod=taxonomy\">taxonomy</a>";
|
||||
$links[] = la(t("taxonomy"), array("mod" => "taxonomy"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
function taxonomy_help() {
|
||||
?>
|
||||
<b>Background</b><br /><br />
|
||||
|
||||
Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's classifier module is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). <br /><br />
|
||||
|
||||
<b>Vocabularies</b><br />When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) that you submit to Drupal using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slash's "Sections". For more complex implementations, you might create a hierarchical list of categories for describing content.<br /><br />
|
||||
|
||||
<b>Setting up a vocabulary</b><br />When you set up a controlled vocabulary, you will be asked to enter some descriptive data and define the attributes of this vocabulary. For example, if you select the "Hierarchy" option, you will be defining a taxonomy or thesaurus. If you select "Relationships" you are allowing the definition of related terms as in a thesaurus. Selecting "Multiple Select" will allow you to describe a node using more than one term.<br /><br />
|
||||
|
||||
<i>Vocabulary name</i><br />Required. The name for this vocabulary. Example: 'Topic'.<br /><br />
|
||||
|
||||
<i>Description</i><br />Optional. Description of the vocabulary, can be used by modules.<br /><br />
|
||||
|
||||
<i>Types</i><br />Required. A comma-seperated list of node types you want to associate this vocabulary with. Available types: blog, book, forum, page, story.<br /><br />
|
||||
|
||||
<i>Relationships</i><br />Allows relationships between terms within this vocabulary. This is synonymous with "See also" type references.<br /><br />
|
||||
|
||||
<i>Hierarchy</i><br />Allows a tree-like hierarchy <br /><br />
|
||||
|
||||
<i>Multiple Select</i><br />Allows nodes to be described using more than one term.<br /><br />
|
||||
|
||||
<b>Adding terms to a vocabulary</b><br />The options you see when adding a term to a vocabulary will depend on what you selected for "Relationships", "Hierarchy" and "Multiple Select" when you created the vocabulary.<br /><br />
|
||||
|
||||
Term name<br />Required. The name for this term. Example: 'Linux'.<br /><br />
|
||||
|
||||
Description<br />Optional. Description of the term, can be used by modules. This is synonymous with a "Scope note".<br /><br />
|
||||
|
||||
Relationships<br />Optional. Select one or many related terms.<br /><br />
|
||||
|
||||
Parent<br />Select the term under which this term is a subset -- the branch of the hierarchy this term belongs under. This is also known as the "Broader term" indicator used in thesauri.<br /><br />
|
||||
|
||||
Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can be used for variant spellings, acronyms, and other terms that have the same meaning as the added term, but which are not explicitly listed in this thesaurus (unauthorized terms).
|
||||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
** admin pages (form, save, overview)
|
||||
*/
|
||||
|
@ -61,10 +59,10 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$form .= form_textfield("Vocabulary name", "name", $edit[name], 50, 64, "Required. The name for this vocabulary. Example: 'Topic'.");
|
||||
$form .= form_textarea("Description", "description", $edit[description], 60, 5, "Optional. Description of the vocabulary, can be used by modules.");
|
||||
$form .= form_select("Types", "types", explode(",", $edit[types]), $nodetypes, "Required. A list of node types you want to associate this vocabulary with.", "", 1);
|
||||
$form .= form_checkbox("Related terms", "relations", 1, $edit[relations], "Optional. Allows <a href=\"admin.php?mod=taxonomy&op=help#relatedterms\">related terms</a> in this vocabulary.");
|
||||
$form .= form_select("Hierarchy", "hierarchy", $edit[hierarchy], array("Disabled", "Single", "Multiple"), "Optional. Allows <a href=\"admin.php?mod=taxonomy&op=help#hierarchy\">a tree-like hierarchy</a> between terms of this vocabulary.", "", 0);
|
||||
$form .= form_checkbox("Related terms", "relations", 1, $edit[relations], "Optional. Allows ".la("related terms", array("mod" => "taxonomy", "op" => "help#relatedterms"))." in this vocabulary.");
|
||||
$form .= form_select("Hierarchy", "hierarchy", $edit[hierarchy], array("Disabled", "Single", "Multiple"), "Optional. Allows ".la("a tree-like hierarchy", array("mod" => "taxonomy", "op" => "help#hierarchy"))." between terms of this vocabulary.", "", 0);
|
||||
$form .= form_checkbox("Multiple select", "multiple", 1, $edit[multiple], "Optional. Allows nodes to have more than one term in this vocabulary.");
|
||||
$form .= form_checkbox("Required", "required", 1, $edit[required], "If enabled every node MUST have at least one meta in this collection");
|
||||
$form .= form_checkbox("Required", "required", 1, $edit[required], "If enabled every node <b>must</b> have at least one term in this vocabulary");
|
||||
$form .= form_textfield("Weight", "weight", $edit["weight"], 3, 3, "Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.");
|
||||
$form .= form_submit("Submit");
|
||||
|
||||
|
@ -99,8 +97,8 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
function taxonomy_del_vocabulary($vid) {
|
||||
db_query("DELETE FROM vocabulary WHERE vid = '". check_input($vid) ."'");
|
||||
$result = db_query("SELECT tid FROM term_data WHERE vid = '". check_input($vid) ."'");
|
||||
db_query("DELETE FROM vocabulary WHERE vid = '%s'", $vid);
|
||||
$result = db_query("SELECT tid FROM term_data WHERE vid = '%s'", $vid);
|
||||
while ($term = db_fetch_object($result)) {
|
||||
taxonomy_del_term($term->tid);
|
||||
}
|
||||
|
@ -112,29 +110,28 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$vocabulary_id = $edit["vid"];
|
||||
}
|
||||
$vocabulary = taxonomy_get_vocabulary($vocabulary_id);
|
||||
#print_r($vocabulary);
|
||||
$form .= form_textfield("Term name", "name", $edit["name"], 50, 64, "Required. The name for this term. Example: 'Linux'.");
|
||||
$form .= form_textarea("Description", "description", $edit["description"], 60, 5, "Optional. Description of the term, can be used by modules.");
|
||||
|
||||
if ($vocabulary->relations) {
|
||||
$form .= _taxonomy_term_select("Related terms", "relations", @array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, "Optional.", 1, "<none>", array($edit["tid"]));
|
||||
$form .= _taxonomy_term_select("Related terms", "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, "Optional.", 1, "<none>", array($edit["tid"]));
|
||||
}
|
||||
|
||||
|
||||
if ($vocabulary->hierarchy) {
|
||||
$parent = array_keys(taxonomy_get_parents($edit["tid"]));
|
||||
taxonomy_get_tree($vocabulary_id, $children, $edit["tid"]);
|
||||
// you can be son of yourself or your children
|
||||
// you can't be son of yourself or your children
|
||||
$exclude = array_keys($children);
|
||||
$exclude[] = $edit["tid"];
|
||||
if ($vocabulary->hierarchy == 1) {
|
||||
$form .= _taxonomy_term_select("Parent", "parent", $parent, $vocabulary_id, "Required. Parent term.", 0, "<root>", $exclude);
|
||||
$form .= _taxonomy_term_select("Parent", "parent", $parent, $vocabulary_id, "Required. ".la("Parent term", array("mod" => "taxonomy", "op" => "help#parent")).".", 0, "<root>", $exclude);
|
||||
} elseif ($vocabulary->hierarchy == 2) {
|
||||
$form .= _taxonomy_term_select("Parents", "parent", $parent, $vocabulary_id, "Required. Parent terms.", 1, "<root>", $exclude);
|
||||
$form .= _taxonomy_term_select("Parents", "parent", $parent, $vocabulary_id, "Required. ".la("Parent terms", array("mod" => "taxonomy", "op" => "help#parent")).".", 1, "<root>", $exclude);
|
||||
}
|
||||
}
|
||||
|
||||
$form .= form_textarea("Synonyms", "synonyms", @implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, "Optional. Synonyms of this term, one synonym per line.");
|
||||
$form .= form_textarea("Synonyms", "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, "Optional. ".la("Synonyms", array("mod" => "taxonomy", "op" => "help#synonyms"))." of this term, one synonym per line.");
|
||||
$form .= form_textfield("Weight", "weight", $edit["weight"], 3, 3, "Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.");
|
||||
$form .= form_hidden("vid", $vocabulary->vid);
|
||||
$form .= form_submit("Submit");
|
||||
|
@ -155,7 +152,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
"weight" => $edit["weight"]
|
||||
);
|
||||
|
||||
db_query("UPDATE term_data SET "._prepare_update($data)." WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("UPDATE term_data SET "._prepare_update($data)." WHERE tid = '%s'", $edit["tid"]);
|
||||
}
|
||||
else if ($edit["tid"]) {
|
||||
taxonomy_del_term($edit["tid"]);
|
||||
|
@ -177,11 +174,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
// relations (seem very powerful, but I have to understand it completely)
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '". check_input($edit["tid"]) ."' OR tid2 = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '%s' OR tid2 = '%s'", $edit["tid"], $edit["tid"]);
|
||||
if ($edit["relations"]) {
|
||||
foreach ($edit["relations"] as $related_id) {
|
||||
if ($related_id != 0) {
|
||||
$rel_q[] = "('". check_input($edit["tid"]) ."', '". check_input($related_id) ."')";
|
||||
$rel_q[] = "('". check_query($edit["tid"]) ."', '". check_query($related_id) ."')";
|
||||
}
|
||||
}
|
||||
if ($rel_q) {
|
||||
|
@ -191,24 +188,24 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
// hierarchy
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '%s'", $edit["tid"]);
|
||||
if (!isset($edit["parent"])) {
|
||||
$edit["parent"] = 0;
|
||||
}
|
||||
if (is_array($edit["parent"])) {
|
||||
foreach ($edit["parent"] as $parent) {
|
||||
$sql[] = "('". check_input($edit["tid"]) ."', '". check_input($parent) ."')";
|
||||
$sql[] = "('". check_query($edit["tid"]) ."', '". check_query($parent) ."')";
|
||||
}
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ".implode(", ", $sql));
|
||||
} else {
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ('". check_input($edit["tid"]) ."', '". check_input($edit["parent"][0]) ."')");
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ('%s', '%s')", $edit["tid"], $edit["parent"][0]);
|
||||
}
|
||||
|
||||
// synonyms (very cool idea indeed)
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '%s'", $edit["tid"]);
|
||||
if ($edit["synonyms"]) {
|
||||
foreach (explode ("\n", $edit["synonyms"]) as $synonym) {
|
||||
$syn_q[] = "('". check_input($edit["tid"]) ."', '". check_input(chop($synonym)) ."')";
|
||||
$syn_q[] = "('". check_query($edit["tid"]) ."', '". check_query(chop($synonym)) ."')";
|
||||
}
|
||||
$synonyms_query = implode(", ", $syn_q);
|
||||
db_query("INSERT INTO term_synonym (tid, name) VALUES $synonyms_query");
|
||||
|
@ -216,11 +213,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
function taxonomy_del_term($tid) {
|
||||
db_query("DELETE FROM term_data WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '". check_input($tid) ."' OR tid2 = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_node WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_data WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '%s' OR tid2 = '%s'", $tid, $tid);
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_node WHERE tid = '%s'", $tid);
|
||||
}
|
||||
|
||||
function taxonomy_overview() {
|
||||
|
@ -232,15 +229,18 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
$output .= " <tr><td>". check_output($vocabulary->name) ."</td><td>". check_output($vocabulary->types) ."</td><td><a href=\"admin.php?mod=taxonomy&type=vocabulary&op=edit&id=".$vocabulary->vid."\">edit vocabulary</a> | <a href=\"admin.php?mod=taxonomy&op=add&type=leaf&vocabulary_id=".$vocabulary->vid."\">add term</a> | <a href=\"admin.php?mod=taxonomy&type=vocabulary&op=preview&id=".$vocabulary->vid."\">preview form</a></td></tr>\n";
|
||||
$links[] = la(t("edit vocabulary"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "edit", "id" => $vocabulary->vid));
|
||||
$links[] = la(t("add term"), array("mod" => "taxonomy", "op" => "add", "type" => "leaf", "vocabulary_id" => $vocabulary->vid));
|
||||
$links[] = la(t("preview form"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "preview", "id" => $vocabulary->vid));
|
||||
|
||||
$output .= " <tr><td>". check_output($vocabulary->name) ."</td><td>". check_output($vocabulary->types) ."</td><td>".implode(" | ", $links)."</td></tr>\n";
|
||||
|
||||
unset($tree);
|
||||
taxonomy_get_tree($vocabulary->vid, $tree);
|
||||
if ($tree) {
|
||||
$output .= "<tr><td colspan=\"3\"><table><tr><td>";
|
||||
#print_r($tree);
|
||||
foreach ($tree as $term) {
|
||||
$output .= "<tr><td><a href=\"admin.php?mod=taxonomy&op=edit&type=term&id=".check_output($term->tid)."\">"._taxonomy_depth($term->depth).check_output($term->name)."</a></td></tr>";
|
||||
$output .= "<tr><td>".la(_taxonomy_depth($term->depth).check_output($term->name), array("mod" => "taxonomy", "op" => "edit", "type" => "term", "id" => check_output($term->tid)))."</td></tr>";
|
||||
}
|
||||
$output .= "</td></tr></table></td></tr>\n";
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// return array of vocabularies, as objects
|
||||
function taxonomy_get_vocabularies($type = '', $key = "vid") {
|
||||
if ($type) {
|
||||
$result = db_query("SELECT * FROM vocabulary WHERE types LIKE '%".check_query($type)."%' ORDER BY weight, name");
|
||||
$result = db_query("SELECT * FROM vocabulary WHERE types LIKE '%%%s%%' ORDER BY weight, name", $type);
|
||||
} else {
|
||||
$result = db_query("SELECT * FROM vocabulary ORDER BY weight, name");
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$terms = $node->taxonomy;
|
||||
}
|
||||
|
||||
$c = db_query("SELECT * FROM vocabulary WHERE types LIKE '%". check_query($type) ."%' ORDER BY weight, name");
|
||||
$c = db_query("SELECT * FROM vocabulary WHERE types LIKE '%%%s%%' ORDER BY weight, name", $type);
|
||||
while ($vocabulary = db_fetch_object($c)) {
|
||||
$result[] .= taxonomy_form($vocabulary->vid, $terms);
|
||||
}
|
||||
|
@ -308,14 +308,14 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
// return 1 if node identified by $nid contains a taxonomy term identified by $tid in his body or title
|
||||
function taxonomy_node_has_term($nid, $tid) {
|
||||
$term_name = db_result(db_query("SELECT name FROM term_data WHERE tid = ". check_query($tid)));
|
||||
$term_name = db_result(db_query("SELECT name FROM term_data WHERE tid = '%s'", $tid));
|
||||
|
||||
return db_result(db_query("SELECT COUNT(n.nid) FROM node n WHERE n.nid = '" . check_query($nid). "' AND ((n.body LIKE '%$term_name%') OR (n.body LIKE '%$term_name%'))"));
|
||||
return db_result(db_query("SELECT COUNT(n.nid) FROM node n WHERE n.nid = '%s' AND ((n.body LIKE '%%%s%%') OR (n.body LIKE '%%%s%%'))", $nid, $term_name, $term_name));
|
||||
}
|
||||
|
||||
// return array of terms of a node beloging to a particular vocabulary identified by $vid
|
||||
function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = "tid") {
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE t.tid = r.tid AND t.vid = '".check_query($vid)."' AND r.nid = '" . check_query($nid) . "' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE t.tid = r.tid AND t.vid = '%s' AND r.nid = '%s' ORDER BY weight", $vid, $nid);
|
||||
$terms = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$terms[$term->$key] = $term;
|
||||
|
@ -328,7 +328,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
static $terms;
|
||||
|
||||
if (!$terms[$nid]) {
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE r.tid = t.tid AND r.nid = '".check_query($nid)."' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE r.tid = t.tid AND r.nid = '%s' ORDER BY weight", $nid);
|
||||
$terms[$nid] = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$terms[$nid][$term->$key] = $term;
|
||||
|
@ -340,7 +340,6 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// save terms of a node
|
||||
function taxonomy_node_save($nid, $terms) {
|
||||
taxonomy_node_delete($nid);
|
||||
#print_r($terms);
|
||||
|
||||
if ($terms) {
|
||||
foreach ($terms as $t) {
|
||||
|
@ -352,13 +351,13 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
// clean up terms
|
||||
function taxonomy_node_delete($nid) {
|
||||
db_query("DELETE FROM term_node WHERE nid = '".check_query($nid)."'");
|
||||
db_query("DELETE FROM term_node WHERE nid = '%s'", $nid);
|
||||
}
|
||||
|
||||
// relations: return array of related terms
|
||||
function taxonomy_get_related($tid, $key = "tid") {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '".check_query($tid)."' OR tid2 = '".check_query($tid)."') ORDER BY weight");
|
||||
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%s' OR tid2 = '%s') ORDER BY weight", $tid, $tid);
|
||||
$related = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$related[$term->$key] = $term;
|
||||
|
@ -367,15 +366,14 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
}
|
||||
|
||||
// hierarchy: get parent term
|
||||
// hierarchy: get parent terms
|
||||
function taxonomy_get_parents($tid, $key = "tid") {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.parent = t.tid AND h.tid = '".check_query($tid)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.parent = t.tid AND h.tid = '%s' ORDER BY weight, name", $tid);
|
||||
$parents = array();
|
||||
while ($parent = db_fetch_object($result)) {
|
||||
$parents[$parent->$key] = $parent;
|
||||
}
|
||||
#print_r($parents);
|
||||
return $parents;
|
||||
} else {
|
||||
return array();
|
||||
|
@ -385,9 +383,9 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// hierarchy: get children
|
||||
function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
|
||||
if ($vid) {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE t.vid = '".check_query($vid)."' AND h.tid = t.tid AND h.parent = '".check_query($tid)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE t.vid = '%s' AND h.tid = t.tid AND h.parent = '%s' ORDER BY weight, name", $vid, $tid);
|
||||
} else {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.tid = t.tid AND parent = '".check_query($tid)."' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.tid = t.tid AND parent = '%s' ORDER BY weight", $tid);
|
||||
}
|
||||
$children = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
|
@ -407,22 +405,19 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$depth++;
|
||||
if ($vocabulary_id) {
|
||||
if (!$children) {
|
||||
$result = db_query("SELECT t.*, parent FROM term_data t, term_hierarchy h WHERE t.tid = h.tid AND t.vid = '".check_query($vocabulary_id)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.*, parent FROM term_data t, term_hierarchy h WHERE t.tid = h.tid AND t.vid = '%s' ORDER BY weight, name", $vocabulary_id);
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$children[$term->parent][] = $term->tid;
|
||||
$terms[$term->tid] = $term;
|
||||
}
|
||||
#print_r($children);
|
||||
}
|
||||
if ($children[$parent]) {
|
||||
foreach ($children[$parent] as $child) {
|
||||
#print_r($terms[$child]);
|
||||
$terms[$child]->depth = $depth;
|
||||
$tree[$terms[$child]->$key] = $terms[$child];
|
||||
$tree[] = $terms[$child];
|
||||
taxonomy_get_tree($vocabulary_id, $tree, $child, $depth, $key);
|
||||
}
|
||||
}
|
||||
#print_r($tree);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -431,29 +426,59 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// synonyms: return array of synonyms
|
||||
function taxonomy_get_synonyms($tid) {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT name FROM term_synonym WHERE tid = '".check_query($tid)."'");
|
||||
$result = db_query("SELECT name FROM term_synonym WHERE tid = '%s'", $tid);
|
||||
while ($synonym = db_fetch_array($result)) {
|
||||
$synonyms[] = $synonym["name"];
|
||||
}
|
||||
return $synonyms;
|
||||
return $synonyms ? $synonyms : array();
|
||||
} else {
|
||||
return "";
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// synonyms: return original term
|
||||
function taxonomy_get_synonym_root($term) {
|
||||
return db_fetch_object(db_query("SELECT * FROM term_synonym s, term_data t WHERE t.tid = s.tid AND s.name = '".check_query($term)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM term_synonym s, term_data t WHERE t.tid = s.tid AND s.name = '%s'", $term));
|
||||
}
|
||||
|
||||
// given a term id, count number of nodes in it
|
||||
function taxonomy_term_count_nodes($tid) {
|
||||
static $count;
|
||||
|
||||
if (!$count) {
|
||||
$result = db_query("SELECT tid, COUNT(*) AS c FROM term_node GROUP BY tid");
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$count[$term->tid] = $term->c;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (_taxonomy_term_children($tid) as $c) {
|
||||
$children_count += taxonomy_term_count_nodes($c);
|
||||
}
|
||||
return $count[$tid] + $children_count;
|
||||
}
|
||||
|
||||
// helper for above function
|
||||
function _taxonomy_term_children($tid) {
|
||||
static $children;
|
||||
|
||||
if (!$children) {
|
||||
$result = db_query("SELECT tid, parent FROM term_hierarchy");
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$children[$term->parent][] = $term->tid;
|
||||
}
|
||||
}
|
||||
return $children[$tid] ? $children[$tid] : array();
|
||||
}
|
||||
|
||||
function taxonomy_get_vocabulary($vid) {
|
||||
// simple cache using a static var?
|
||||
return db_fetch_object(db_query("SELECT * FROM vocabulary WHERE vid = '".check_query($vid)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM vocabulary WHERE vid = '%s'", $vid));
|
||||
}
|
||||
|
||||
function taxonomy_get_term($tid) {
|
||||
// simple cache using a static var?
|
||||
return db_fetch_object(db_query("SELECT * FROM term_data WHERE tid = '".check_query($tid)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM term_data WHERE tid = '%s'", $tid));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -500,7 +525,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
function _prepare_update($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$q[] = "$key = '". check_input($value) ."'";
|
||||
$q[] = "$key = '". check_query($value) ."'";
|
||||
}
|
||||
$result = implode(", ", $q);
|
||||
return $result;
|
||||
|
@ -511,13 +536,26 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$result = implode(", ", array_keys($data));
|
||||
} else {
|
||||
foreach (array_values($data) as $value) {
|
||||
$q[] = "'". check_input($value) ."'";
|
||||
$q[] = "'". check_query($value) ."'";
|
||||
}
|
||||
$result = implode(", ", $q);
|
||||
}
|
||||
return "($result)";
|
||||
}
|
||||
/*
|
||||
|
||||
function taxonomy_page() {
|
||||
global $op;
|
||||
|
||||
switch ($op) {
|
||||
case "feed":
|
||||
taxonomy_feed();
|
||||
break;
|
||||
default:
|
||||
// TODO: pretty display of all vocabularies
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** admin
|
||||
*/
|
||||
|
||||
|
@ -525,8 +563,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
global $edit, $type, $op, $id, $tree;
|
||||
|
||||
if (user_access("administer taxonomy")) {
|
||||
$links[] = la(t("add new vocabulary"), array("mod" => "taxonomy", "op" => "add", "type" => "vocabulary"));
|
||||
$links[] = la(t("overview"), array("mod" => "taxonomy"));
|
||||
$links[] = la(t("help"), array("mod" => "taxonomy", "op" => "help"));
|
||||
|
||||
print "<SMALL><A HREF=\"admin.php?mod=taxonomy&op=add&type=vocabulary\">add new vocabulary</A> | <A HREF=\"admin.php?mod=taxonomy\">overview</A> | <A HREF=\"admin.php?mod=taxonomy&op=help\">help</A></SMALL><HR>\n";
|
||||
print "<small>".implode(" | ", $links)."</small><hr>\n";
|
||||
|
||||
switch ($op) {
|
||||
case "add":
|
||||
|
@ -563,7 +604,118 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
else {
|
||||
print message_access();
|
||||
}
|
||||
#print_r(taxonomy_get_children(2));
|
||||
}
|
||||
|
||||
function taxonomy_help() {
|
||||
?>
|
||||
<h3>Background</h3>
|
||||
Classifying nodes allows for the organization of content into categories and
|
||||
subcategories of description. These categories can be used to organize and retrieve
|
||||
similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible
|
||||
classification system that allows for multiple lists of categories for classification
|
||||
(controlled vocabularies) and offers the possibility of creating thesauri (controlled
|
||||
vocabularies that indicate the relationship of terms) and taxonomies (controlled
|
||||
vocabularies where relationships are indicated hierarchically). For details about
|
||||
<a href="http://www.eleganthack.com/archives/002165.html#002165">classification
|
||||
types</a> and insight into the development of <i>taxonomy.module</i>, see this
|
||||
<a href="http://www.drupal.org/node.php?id=55">drupal.org discussion</a>.<br />
|
||||
<h3>An Example Taxonomy - Foods</h3>
|
||||
<p>Dairy <br>
|
||||
--Milk <br>
|
||||
Drink <br>
|
||||
--Alchohol <br>
|
||||
--Pop <br>
|
||||
--Milk<br>
|
||||
Meat <br>
|
||||
--Beef <br>
|
||||
--Chicken <br>
|
||||
--Lamb <br>
|
||||
Spices <br>
|
||||
--Sugar</p>
|
||||
<p><b>Notes</b></p>
|
||||
<ul>
|
||||
<li>The term <i>Milk</i> appears within both <i>Dairy</i> and <i>Drink</i>.
|
||||
This is an example of <i>Multiple Parents</i> for a term.</li>
|
||||
<li>The order of siblings (e.g. <i>Beef</i>, <i>Chicken</i>, <i>Lamb</i>) in
|
||||
the taxonomy may be controlled with the <i>Weight</i> parameter. </li>
|
||||
</ul>
|
||||
<h4></h4>
|
||||
<h3>Vocabularies</h3>
|
||||
When you create a controlled vocabulary you are creating a set of terms to use
|
||||
for describing content (known as descriptors in indexing lingo). Drupal allows
|
||||
you to describe each node of content (blog, story, etc.)
|
||||
using one or many of these terms. For simple implementations, you might
|
||||
create a set of categories without subcategories, similar to <a href="http://www.slashdot.com">Slashdot's</a> "Sections".
|
||||
For more complex implementations, you might create a hierarchical list of categories
|
||||
such as the example <i>Food</i> taxonomy above.
|
||||
|
||||
<h4>Setting up a vocabulary</h4>
|
||||
<p>When you set up a controlled vocabulary, you will be asked to enter some descriptive
|
||||
data and define the attributes of this vocabulary. For example, if you select
|
||||
the <i>Hierarchy </i>option, you will be defining a taxonomy or a thesaurus. If
|
||||
you select <i>Related Terms</i> option, you are allowing the definition of related
|
||||
terms as in a thesaurus. Selecting <i>Multiple Select</i> will allow you to describe
|
||||
a node using more than one term. That node will then appear in each term's page,
|
||||
thus increasing the chance that a user will find it.</p>
|
||||
<i>Vocabulary name</i><br />
|
||||
Required. The name for this vocabulary. Example: <i>Dairy</i>.<br />
|
||||
<br />
|
||||
<i>Description</i><br />
|
||||
Optional. Description of the vocabulary, can be used by modules and feeds.<br />
|
||||
<br />
|
||||
<i>Types</i><br />
|
||||
Required. The list of node types you want to associate this vocabulary
|
||||
with. Some available types are: blog, book, forum, page, story.<br />
|
||||
<br />
|
||||
<i><a name="relatedterms"></a>Related Terms</i><br />
|
||||
Allows relationships between terms within this vocabulary. Think of these as
|
||||
<i>See also</i> references.<br />
|
||||
<br />
|
||||
<i><a name="hierarchy"></a>Hierarchy</i><br />
|
||||
Allows a tree-like taxonomy, as in our <i>Foods</i> example above<br />
|
||||
<br />
|
||||
<i>Multiple Select</i><br />
|
||||
Allows nodes to be described using more than one term. Nodes may then appear on
|
||||
multiple taxonomy pages.<br />
|
||||
<h4>Adding terms to a vocabulary</h4>
|
||||
The options you see when adding a term to a vocabulary will depend on what you
|
||||
selected for <i>Related Terms</i>, <i>Hierarchy </i>and <i>Multiple Select</i>
|
||||
when you created the corrosponding vocabulary.<br />
|
||||
<br />
|
||||
<i>Term name</i><br />
|
||||
Required. The name for this term. Example: <i>Milk</i><br />
|
||||
<br />
|
||||
<i>Description</i><br />
|
||||
Optional. Description of the term that may be used by modules and RSS feeds.
|
||||
This is synonymous with a 'Scope note'.<br />
|
||||
<br />
|
||||
<i><a name="parent"></a>Parent</i><br />
|
||||
Required. Select the term under which this term is a subset -- the branch of the hierarchy
|
||||
that this term belongs under. This is also known as the "Broader term" indicator
|
||||
used in thesauri.<br />
|
||||
<br />
|
||||
<i><a name="synonyms"></a>Synonyms</i><br />
|
||||
Optional. Enter synonyms for this term, one synonym per line. Synonyms can be used for
|
||||
variant spellings, acronyms, and other terms that have the same meaning as the
|
||||
added term, but which are not explicitly listed in this thesaurus (i.e. <i>unauthorized
|
||||
terms</i>).<br />
|
||||
|
||||
<h3>Displaying Nodes Organized by Term(s)</h3>
|
||||
<p>In order to view the nodes associated with a term or a collection of terms, you
|
||||
should browse to a properly formed URL. For example, see
|
||||
<a href="<?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?></a>.
|
||||
Taxonomy URLs always contain a termID or list of termIDs at the end of the URL (aka <i>querystring</i>).
|
||||
You may learn the termID for a given term by hovering over that term in the <? echo la("Taxonomy Overview", array("mod" => "taxonomy")) ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>.
|
||||
If you wish to see nodes from a collection of termIDs, separate each termID with a comma.
|
||||
Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>.
|
||||
<i>or</i> shows nodes which appear in <b>any</b> of the termIDs while <i>and</i> shows nodes in <b>all</b> the specified termIDs.
|
||||
Thus, <i>or</i> is less specific than <i>and</i>.
|
||||
</p>
|
||||
|
||||
<h3>RSS Feeds</h3>
|
||||
<p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested
|
||||
users may subscribe. The URL format for an sample RSS feed is
|
||||
<a href="<?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?></a>.</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,52 +1,50 @@
|
|||
<?php
|
||||
|
||||
function taxonomy_feed() {
|
||||
global $id, $or, $and, $type;
|
||||
|
||||
if ($type == "voc") {
|
||||
//TODO - vocabulary feed. How to represent an outline in XML?
|
||||
}
|
||||
else {
|
||||
if ($or) {
|
||||
foreach ((explode(",", $or)) as $t) {
|
||||
$terms[] = "'".check_query($t)."'";
|
||||
}
|
||||
$result = db_query("SELECT DISTINCT(n.nid), type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND status = '1' ORDER BY static DESC, created DESC LIMIT 15");
|
||||
$term = taxonomy_get_term($or);
|
||||
}
|
||||
else if ($and) {
|
||||
foreach ((explode(",", $and)) as $t) {
|
||||
$terms[] = "'".check_query($t)."'";
|
||||
}
|
||||
$result = db_query("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC LIMIT 15");
|
||||
$term = taxonomy_get_term($and);
|
||||
}
|
||||
else {
|
||||
return node_feed();
|
||||
}
|
||||
|
||||
$channel["title"] = variable_get("site_name", "drupal") . " - " . $term->name;
|
||||
$channel["link"] = path_uri() . "index.php?or=$or";
|
||||
$channel["description"] = $term->description;
|
||||
|
||||
node_feed($result, $channel);
|
||||
}
|
||||
}
|
||||
|
||||
function taxonomy_perm() {
|
||||
return array("administer taxonomy");
|
||||
}
|
||||
|
||||
function taxonomy_link($type) {
|
||||
if ($type == "admin" && user_access("administer taxonomy")) {
|
||||
$links[] = "<a href=\"admin.php?mod=taxonomy\">taxonomy</a>";
|
||||
$links[] = la(t("taxonomy"), array("mod" => "taxonomy"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
function taxonomy_help() {
|
||||
?>
|
||||
<b>Background</b><br /><br />
|
||||
|
||||
Classifying nodes allows for the organization of content into categories and subcategories of description. These categories can be used to organize and retrieve similarly described content. Drupal's classifier module is an extremely flexible classification system that allows for multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). <br /><br />
|
||||
|
||||
<b>Vocabularies</b><br />When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) that you submit to Drupal using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slash's "Sections". For more complex implementations, you might create a hierarchical list of categories for describing content.<br /><br />
|
||||
|
||||
<b>Setting up a vocabulary</b><br />When you set up a controlled vocabulary, you will be asked to enter some descriptive data and define the attributes of this vocabulary. For example, if you select the "Hierarchy" option, you will be defining a taxonomy or thesaurus. If you select "Relationships" you are allowing the definition of related terms as in a thesaurus. Selecting "Multiple Select" will allow you to describe a node using more than one term.<br /><br />
|
||||
|
||||
<i>Vocabulary name</i><br />Required. The name for this vocabulary. Example: 'Topic'.<br /><br />
|
||||
|
||||
<i>Description</i><br />Optional. Description of the vocabulary, can be used by modules.<br /><br />
|
||||
|
||||
<i>Types</i><br />Required. A comma-seperated list of node types you want to associate this vocabulary with. Available types: blog, book, forum, page, story.<br /><br />
|
||||
|
||||
<i>Relationships</i><br />Allows relationships between terms within this vocabulary. This is synonymous with "See also" type references.<br /><br />
|
||||
|
||||
<i>Hierarchy</i><br />Allows a tree-like hierarchy <br /><br />
|
||||
|
||||
<i>Multiple Select</i><br />Allows nodes to be described using more than one term.<br /><br />
|
||||
|
||||
<b>Adding terms to a vocabulary</b><br />The options you see when adding a term to a vocabulary will depend on what you selected for "Relationships", "Hierarchy" and "Multiple Select" when you created the vocabulary.<br /><br />
|
||||
|
||||
Term name<br />Required. The name for this term. Example: 'Linux'.<br /><br />
|
||||
|
||||
Description<br />Optional. Description of the term, can be used by modules. This is synonymous with a "Scope note".<br /><br />
|
||||
|
||||
Relationships<br />Optional. Select one or many related terms.<br /><br />
|
||||
|
||||
Parent<br />Select the term under which this term is a subset -- the branch of the hierarchy this term belongs under. This is also known as the "Broader term" indicator used in thesauri.<br /><br />
|
||||
|
||||
Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can be used for variant spellings, acronyms, and other terms that have the same meaning as the added term, but which are not explicitly listed in this thesaurus (unauthorized terms).
|
||||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
** admin pages (form, save, overview)
|
||||
*/
|
||||
|
@ -61,10 +59,10 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$form .= form_textfield("Vocabulary name", "name", $edit[name], 50, 64, "Required. The name for this vocabulary. Example: 'Topic'.");
|
||||
$form .= form_textarea("Description", "description", $edit[description], 60, 5, "Optional. Description of the vocabulary, can be used by modules.");
|
||||
$form .= form_select("Types", "types", explode(",", $edit[types]), $nodetypes, "Required. A list of node types you want to associate this vocabulary with.", "", 1);
|
||||
$form .= form_checkbox("Related terms", "relations", 1, $edit[relations], "Optional. Allows <a href=\"admin.php?mod=taxonomy&op=help#relatedterms\">related terms</a> in this vocabulary.");
|
||||
$form .= form_select("Hierarchy", "hierarchy", $edit[hierarchy], array("Disabled", "Single", "Multiple"), "Optional. Allows <a href=\"admin.php?mod=taxonomy&op=help#hierarchy\">a tree-like hierarchy</a> between terms of this vocabulary.", "", 0);
|
||||
$form .= form_checkbox("Related terms", "relations", 1, $edit[relations], "Optional. Allows ".la("related terms", array("mod" => "taxonomy", "op" => "help#relatedterms"))." in this vocabulary.");
|
||||
$form .= form_select("Hierarchy", "hierarchy", $edit[hierarchy], array("Disabled", "Single", "Multiple"), "Optional. Allows ".la("a tree-like hierarchy", array("mod" => "taxonomy", "op" => "help#hierarchy"))." between terms of this vocabulary.", "", 0);
|
||||
$form .= form_checkbox("Multiple select", "multiple", 1, $edit[multiple], "Optional. Allows nodes to have more than one term in this vocabulary.");
|
||||
$form .= form_checkbox("Required", "required", 1, $edit[required], "If enabled every node MUST have at least one meta in this collection");
|
||||
$form .= form_checkbox("Required", "required", 1, $edit[required], "If enabled every node <b>must</b> have at least one term in this vocabulary");
|
||||
$form .= form_textfield("Weight", "weight", $edit["weight"], 3, 3, "Optional. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.");
|
||||
$form .= form_submit("Submit");
|
||||
|
||||
|
@ -99,8 +97,8 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
function taxonomy_del_vocabulary($vid) {
|
||||
db_query("DELETE FROM vocabulary WHERE vid = '". check_input($vid) ."'");
|
||||
$result = db_query("SELECT tid FROM term_data WHERE vid = '". check_input($vid) ."'");
|
||||
db_query("DELETE FROM vocabulary WHERE vid = '%s'", $vid);
|
||||
$result = db_query("SELECT tid FROM term_data WHERE vid = '%s'", $vid);
|
||||
while ($term = db_fetch_object($result)) {
|
||||
taxonomy_del_term($term->tid);
|
||||
}
|
||||
|
@ -112,29 +110,28 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$vocabulary_id = $edit["vid"];
|
||||
}
|
||||
$vocabulary = taxonomy_get_vocabulary($vocabulary_id);
|
||||
#print_r($vocabulary);
|
||||
$form .= form_textfield("Term name", "name", $edit["name"], 50, 64, "Required. The name for this term. Example: 'Linux'.");
|
||||
$form .= form_textarea("Description", "description", $edit["description"], 60, 5, "Optional. Description of the term, can be used by modules.");
|
||||
|
||||
if ($vocabulary->relations) {
|
||||
$form .= _taxonomy_term_select("Related terms", "relations", @array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, "Optional.", 1, "<none>", array($edit["tid"]));
|
||||
$form .= _taxonomy_term_select("Related terms", "relations", array_keys(taxonomy_get_related($edit["tid"])), $vocabulary_id, "Optional.", 1, "<none>", array($edit["tid"]));
|
||||
}
|
||||
|
||||
|
||||
if ($vocabulary->hierarchy) {
|
||||
$parent = array_keys(taxonomy_get_parents($edit["tid"]));
|
||||
taxonomy_get_tree($vocabulary_id, $children, $edit["tid"]);
|
||||
// you can be son of yourself or your children
|
||||
// you can't be son of yourself or your children
|
||||
$exclude = array_keys($children);
|
||||
$exclude[] = $edit["tid"];
|
||||
if ($vocabulary->hierarchy == 1) {
|
||||
$form .= _taxonomy_term_select("Parent", "parent", $parent, $vocabulary_id, "Required. Parent term.", 0, "<root>", $exclude);
|
||||
$form .= _taxonomy_term_select("Parent", "parent", $parent, $vocabulary_id, "Required. ".la("Parent term", array("mod" => "taxonomy", "op" => "help#parent")).".", 0, "<root>", $exclude);
|
||||
} elseif ($vocabulary->hierarchy == 2) {
|
||||
$form .= _taxonomy_term_select("Parents", "parent", $parent, $vocabulary_id, "Required. Parent terms.", 1, "<root>", $exclude);
|
||||
$form .= _taxonomy_term_select("Parents", "parent", $parent, $vocabulary_id, "Required. ".la("Parent terms", array("mod" => "taxonomy", "op" => "help#parent")).".", 1, "<root>", $exclude);
|
||||
}
|
||||
}
|
||||
|
||||
$form .= form_textarea("Synonyms", "synonyms", @implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, "Optional. Synonyms of this term, one synonym per line.");
|
||||
$form .= form_textarea("Synonyms", "synonyms", implode("\n", taxonomy_get_synonyms($edit["tid"])), 30, 5, "Optional. ".la("Synonyms", array("mod" => "taxonomy", "op" => "help#synonyms"))." of this term, one synonym per line.");
|
||||
$form .= form_textfield("Weight", "weight", $edit["weight"], 3, 3, "Optional. In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.");
|
||||
$form .= form_hidden("vid", $vocabulary->vid);
|
||||
$form .= form_submit("Submit");
|
||||
|
@ -155,7 +152,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
"weight" => $edit["weight"]
|
||||
);
|
||||
|
||||
db_query("UPDATE term_data SET "._prepare_update($data)." WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("UPDATE term_data SET "._prepare_update($data)." WHERE tid = '%s'", $edit["tid"]);
|
||||
}
|
||||
else if ($edit["tid"]) {
|
||||
taxonomy_del_term($edit["tid"]);
|
||||
|
@ -177,11 +174,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
// relations (seem very powerful, but I have to understand it completely)
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '". check_input($edit["tid"]) ."' OR tid2 = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '%s' OR tid2 = '%s'", $edit["tid"], $edit["tid"]);
|
||||
if ($edit["relations"]) {
|
||||
foreach ($edit["relations"] as $related_id) {
|
||||
if ($related_id != 0) {
|
||||
$rel_q[] = "('". check_input($edit["tid"]) ."', '". check_input($related_id) ."')";
|
||||
$rel_q[] = "('". check_query($edit["tid"]) ."', '". check_query($related_id) ."')";
|
||||
}
|
||||
}
|
||||
if ($rel_q) {
|
||||
|
@ -191,24 +188,24 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
// hierarchy
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '%s'", $edit["tid"]);
|
||||
if (!isset($edit["parent"])) {
|
||||
$edit["parent"] = 0;
|
||||
}
|
||||
if (is_array($edit["parent"])) {
|
||||
foreach ($edit["parent"] as $parent) {
|
||||
$sql[] = "('". check_input($edit["tid"]) ."', '". check_input($parent) ."')";
|
||||
$sql[] = "('". check_query($edit["tid"]) ."', '". check_query($parent) ."')";
|
||||
}
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ".implode(", ", $sql));
|
||||
} else {
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ('". check_input($edit["tid"]) ."', '". check_input($edit["parent"][0]) ."')");
|
||||
db_query("INSERT INTO term_hierarchy (tid, parent) VALUES ('%s', '%s')", $edit["tid"], $edit["parent"][0]);
|
||||
}
|
||||
|
||||
// synonyms (very cool idea indeed)
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '". check_input($edit["tid"]) ."'");
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '%s'", $edit["tid"]);
|
||||
if ($edit["synonyms"]) {
|
||||
foreach (explode ("\n", $edit["synonyms"]) as $synonym) {
|
||||
$syn_q[] = "('". check_input($edit["tid"]) ."', '". check_input(chop($synonym)) ."')";
|
||||
$syn_q[] = "('". check_query($edit["tid"]) ."', '". check_query(chop($synonym)) ."')";
|
||||
}
|
||||
$synonyms_query = implode(", ", $syn_q);
|
||||
db_query("INSERT INTO term_synonym (tid, name) VALUES $synonyms_query");
|
||||
|
@ -216,11 +213,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
|
||||
function taxonomy_del_term($tid) {
|
||||
db_query("DELETE FROM term_data WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '". check_input($tid) ."' OR tid2 = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_node WHERE tid = '". check_input($tid) ."'");
|
||||
db_query("DELETE FROM term_data WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_hierarchy WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_relation WHERE tid1 = '%s' OR tid2 = '%s'", $tid, $tid);
|
||||
db_query("DELETE FROM term_synonym WHERE tid = '%s'", $tid);
|
||||
db_query("DELETE FROM term_node WHERE tid = '%s'", $tid);
|
||||
}
|
||||
|
||||
function taxonomy_overview() {
|
||||
|
@ -232,15 +229,18 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
$vocabularies = taxonomy_get_vocabularies();
|
||||
foreach ($vocabularies as $vocabulary) {
|
||||
$output .= " <tr><td>". check_output($vocabulary->name) ."</td><td>". check_output($vocabulary->types) ."</td><td><a href=\"admin.php?mod=taxonomy&type=vocabulary&op=edit&id=".$vocabulary->vid."\">edit vocabulary</a> | <a href=\"admin.php?mod=taxonomy&op=add&type=leaf&vocabulary_id=".$vocabulary->vid."\">add term</a> | <a href=\"admin.php?mod=taxonomy&type=vocabulary&op=preview&id=".$vocabulary->vid."\">preview form</a></td></tr>\n";
|
||||
$links[] = la(t("edit vocabulary"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "edit", "id" => $vocabulary->vid));
|
||||
$links[] = la(t("add term"), array("mod" => "taxonomy", "op" => "add", "type" => "leaf", "vocabulary_id" => $vocabulary->vid));
|
||||
$links[] = la(t("preview form"), array("mod" => "taxonomy", "type" => "vocabulary", "op" => "preview", "id" => $vocabulary->vid));
|
||||
|
||||
$output .= " <tr><td>". check_output($vocabulary->name) ."</td><td>". check_output($vocabulary->types) ."</td><td>".implode(" | ", $links)."</td></tr>\n";
|
||||
|
||||
unset($tree);
|
||||
taxonomy_get_tree($vocabulary->vid, $tree);
|
||||
if ($tree) {
|
||||
$output .= "<tr><td colspan=\"3\"><table><tr><td>";
|
||||
#print_r($tree);
|
||||
foreach ($tree as $term) {
|
||||
$output .= "<tr><td><a href=\"admin.php?mod=taxonomy&op=edit&type=term&id=".check_output($term->tid)."\">"._taxonomy_depth($term->depth).check_output($term->name)."</a></td></tr>";
|
||||
$output .= "<tr><td>".la(_taxonomy_depth($term->depth).check_output($term->name), array("mod" => "taxonomy", "op" => "edit", "type" => "term", "id" => check_output($term->tid)))."</td></tr>";
|
||||
}
|
||||
$output .= "</td></tr></table></td></tr>\n";
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// return array of vocabularies, as objects
|
||||
function taxonomy_get_vocabularies($type = '', $key = "vid") {
|
||||
if ($type) {
|
||||
$result = db_query("SELECT * FROM vocabulary WHERE types LIKE '%".check_query($type)."%' ORDER BY weight, name");
|
||||
$result = db_query("SELECT * FROM vocabulary WHERE types LIKE '%%%s%%' ORDER BY weight, name", $type);
|
||||
} else {
|
||||
$result = db_query("SELECT * FROM vocabulary ORDER BY weight, name");
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$terms = $node->taxonomy;
|
||||
}
|
||||
|
||||
$c = db_query("SELECT * FROM vocabulary WHERE types LIKE '%". check_query($type) ."%' ORDER BY weight, name");
|
||||
$c = db_query("SELECT * FROM vocabulary WHERE types LIKE '%%%s%%' ORDER BY weight, name", $type);
|
||||
while ($vocabulary = db_fetch_object($c)) {
|
||||
$result[] .= taxonomy_form($vocabulary->vid, $terms);
|
||||
}
|
||||
|
@ -308,14 +308,14 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
// return 1 if node identified by $nid contains a taxonomy term identified by $tid in his body or title
|
||||
function taxonomy_node_has_term($nid, $tid) {
|
||||
$term_name = db_result(db_query("SELECT name FROM term_data WHERE tid = ". check_query($tid)));
|
||||
$term_name = db_result(db_query("SELECT name FROM term_data WHERE tid = '%s'", $tid));
|
||||
|
||||
return db_result(db_query("SELECT COUNT(n.nid) FROM node n WHERE n.nid = '" . check_query($nid). "' AND ((n.body LIKE '%$term_name%') OR (n.body LIKE '%$term_name%'))"));
|
||||
return db_result(db_query("SELECT COUNT(n.nid) FROM node n WHERE n.nid = '%s' AND ((n.body LIKE '%%%s%%') OR (n.body LIKE '%%%s%%'))", $nid, $term_name, $term_name));
|
||||
}
|
||||
|
||||
// return array of terms of a node beloging to a particular vocabulary identified by $vid
|
||||
function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = "tid") {
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE t.tid = r.tid AND t.vid = '".check_query($vid)."' AND r.nid = '" . check_query($nid) . "' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE t.tid = r.tid AND t.vid = '%s' AND r.nid = '%s' ORDER BY weight", $vid, $nid);
|
||||
$terms = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$terms[$term->$key] = $term;
|
||||
|
@ -328,7 +328,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
static $terms;
|
||||
|
||||
if (!$terms[$nid]) {
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE r.tid = t.tid AND r.nid = '".check_query($nid)."' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_data t, term_node r WHERE r.tid = t.tid AND r.nid = '%s' ORDER BY weight", $nid);
|
||||
$terms[$nid] = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$terms[$nid][$term->$key] = $term;
|
||||
|
@ -340,7 +340,6 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// save terms of a node
|
||||
function taxonomy_node_save($nid, $terms) {
|
||||
taxonomy_node_delete($nid);
|
||||
#print_r($terms);
|
||||
|
||||
if ($terms) {
|
||||
foreach ($terms as $t) {
|
||||
|
@ -352,13 +351,13 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
// clean up terms
|
||||
function taxonomy_node_delete($nid) {
|
||||
db_query("DELETE FROM term_node WHERE nid = '".check_query($nid)."'");
|
||||
db_query("DELETE FROM term_node WHERE nid = '%s'", $nid);
|
||||
}
|
||||
|
||||
// relations: return array of related terms
|
||||
function taxonomy_get_related($tid, $key = "tid") {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '".check_query($tid)."' OR tid2 = '".check_query($tid)."') ORDER BY weight");
|
||||
$result = db_query("SELECT t.*, tid1, tid2 FROM term_relation, term_data t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = '%s' OR tid2 = '%s') ORDER BY weight", $tid, $tid);
|
||||
$related = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$related[$term->$key] = $term;
|
||||
|
@ -367,15 +366,14 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
}
|
||||
}
|
||||
|
||||
// hierarchy: get parent term
|
||||
// hierarchy: get parent terms
|
||||
function taxonomy_get_parents($tid, $key = "tid") {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.parent = t.tid AND h.tid = '".check_query($tid)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.parent = t.tid AND h.tid = '%s' ORDER BY weight, name", $tid);
|
||||
$parents = array();
|
||||
while ($parent = db_fetch_object($result)) {
|
||||
$parents[$parent->$key] = $parent;
|
||||
}
|
||||
#print_r($parents);
|
||||
return $parents;
|
||||
} else {
|
||||
return array();
|
||||
|
@ -385,9 +383,9 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// hierarchy: get children
|
||||
function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
|
||||
if ($vid) {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE t.vid = '".check_query($vid)."' AND h.tid = t.tid AND h.parent = '".check_query($tid)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE t.vid = '%s' AND h.tid = t.tid AND h.parent = '%s' ORDER BY weight, name", $vid, $tid);
|
||||
} else {
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.tid = t.tid AND parent = '".check_query($tid)."' ORDER BY weight");
|
||||
$result = db_query("SELECT t.* FROM term_hierarchy h, term_data t WHERE h.tid = t.tid AND parent = '%s' ORDER BY weight", $tid);
|
||||
}
|
||||
$children = array();
|
||||
while ($term = db_fetch_object($result)) {
|
||||
|
@ -407,22 +405,19 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$depth++;
|
||||
if ($vocabulary_id) {
|
||||
if (!$children) {
|
||||
$result = db_query("SELECT t.*, parent FROM term_data t, term_hierarchy h WHERE t.tid = h.tid AND t.vid = '".check_query($vocabulary_id)."' ORDER BY weight, name");
|
||||
$result = db_query("SELECT t.*, parent FROM term_data t, term_hierarchy h WHERE t.tid = h.tid AND t.vid = '%s' ORDER BY weight, name", $vocabulary_id);
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$children[$term->parent][] = $term->tid;
|
||||
$terms[$term->tid] = $term;
|
||||
}
|
||||
#print_r($children);
|
||||
}
|
||||
if ($children[$parent]) {
|
||||
foreach ($children[$parent] as $child) {
|
||||
#print_r($terms[$child]);
|
||||
$terms[$child]->depth = $depth;
|
||||
$tree[$terms[$child]->$key] = $terms[$child];
|
||||
$tree[] = $terms[$child];
|
||||
taxonomy_get_tree($vocabulary_id, $tree, $child, $depth, $key);
|
||||
}
|
||||
}
|
||||
#print_r($tree);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -431,29 +426,59 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
// synonyms: return array of synonyms
|
||||
function taxonomy_get_synonyms($tid) {
|
||||
if ($tid) {
|
||||
$result = db_query("SELECT name FROM term_synonym WHERE tid = '".check_query($tid)."'");
|
||||
$result = db_query("SELECT name FROM term_synonym WHERE tid = '%s'", $tid);
|
||||
while ($synonym = db_fetch_array($result)) {
|
||||
$synonyms[] = $synonym["name"];
|
||||
}
|
||||
return $synonyms;
|
||||
return $synonyms ? $synonyms : array();
|
||||
} else {
|
||||
return "";
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
// synonyms: return original term
|
||||
function taxonomy_get_synonym_root($term) {
|
||||
return db_fetch_object(db_query("SELECT * FROM term_synonym s, term_data t WHERE t.tid = s.tid AND s.name = '".check_query($term)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM term_synonym s, term_data t WHERE t.tid = s.tid AND s.name = '%s'", $term));
|
||||
}
|
||||
|
||||
// given a term id, count number of nodes in it
|
||||
function taxonomy_term_count_nodes($tid) {
|
||||
static $count;
|
||||
|
||||
if (!$count) {
|
||||
$result = db_query("SELECT tid, COUNT(*) AS c FROM term_node GROUP BY tid");
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$count[$term->tid] = $term->c;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (_taxonomy_term_children($tid) as $c) {
|
||||
$children_count += taxonomy_term_count_nodes($c);
|
||||
}
|
||||
return $count[$tid] + $children_count;
|
||||
}
|
||||
|
||||
// helper for above function
|
||||
function _taxonomy_term_children($tid) {
|
||||
static $children;
|
||||
|
||||
if (!$children) {
|
||||
$result = db_query("SELECT tid, parent FROM term_hierarchy");
|
||||
while ($term = db_fetch_object($result)) {
|
||||
$children[$term->parent][] = $term->tid;
|
||||
}
|
||||
}
|
||||
return $children[$tid] ? $children[$tid] : array();
|
||||
}
|
||||
|
||||
function taxonomy_get_vocabulary($vid) {
|
||||
// simple cache using a static var?
|
||||
return db_fetch_object(db_query("SELECT * FROM vocabulary WHERE vid = '".check_query($vid)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM vocabulary WHERE vid = '%s'", $vid));
|
||||
}
|
||||
|
||||
function taxonomy_get_term($tid) {
|
||||
// simple cache using a static var?
|
||||
return db_fetch_object(db_query("SELECT * FROM term_data WHERE tid = '".check_query($tid)."'"));
|
||||
return db_fetch_object(db_query("SELECT * FROM term_data WHERE tid = '%s'", $tid));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -500,7 +525,7 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
|
||||
function _prepare_update($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
$q[] = "$key = '". check_input($value) ."'";
|
||||
$q[] = "$key = '". check_query($value) ."'";
|
||||
}
|
||||
$result = implode(", ", $q);
|
||||
return $result;
|
||||
|
@ -511,13 +536,26 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
$result = implode(", ", array_keys($data));
|
||||
} else {
|
||||
foreach (array_values($data) as $value) {
|
||||
$q[] = "'". check_input($value) ."'";
|
||||
$q[] = "'". check_query($value) ."'";
|
||||
}
|
||||
$result = implode(", ", $q);
|
||||
}
|
||||
return "($result)";
|
||||
}
|
||||
/*
|
||||
|
||||
function taxonomy_page() {
|
||||
global $op;
|
||||
|
||||
switch ($op) {
|
||||
case "feed":
|
||||
taxonomy_feed();
|
||||
break;
|
||||
default:
|
||||
// TODO: pretty display of all vocabularies
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** admin
|
||||
*/
|
||||
|
||||
|
@ -525,8 +563,11 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
global $edit, $type, $op, $id, $tree;
|
||||
|
||||
if (user_access("administer taxonomy")) {
|
||||
$links[] = la(t("add new vocabulary"), array("mod" => "taxonomy", "op" => "add", "type" => "vocabulary"));
|
||||
$links[] = la(t("overview"), array("mod" => "taxonomy"));
|
||||
$links[] = la(t("help"), array("mod" => "taxonomy", "op" => "help"));
|
||||
|
||||
print "<SMALL><A HREF=\"admin.php?mod=taxonomy&op=add&type=vocabulary\">add new vocabulary</A> | <A HREF=\"admin.php?mod=taxonomy\">overview</A> | <A HREF=\"admin.php?mod=taxonomy&op=help\">help</A></SMALL><HR>\n";
|
||||
print "<small>".implode(" | ", $links)."</small><hr>\n";
|
||||
|
||||
switch ($op) {
|
||||
case "add":
|
||||
|
@ -563,7 +604,118 @@ Synonyms<br />Enter synonyms for this term, one synonym per line. Synonyms can b
|
|||
else {
|
||||
print message_access();
|
||||
}
|
||||
#print_r(taxonomy_get_children(2));
|
||||
}
|
||||
|
||||
function taxonomy_help() {
|
||||
?>
|
||||
<h3>Background</h3>
|
||||
Classifying nodes allows for the organization of content into categories and
|
||||
subcategories of description. These categories can be used to organize and retrieve
|
||||
similarly described content. Drupal's <i>taxonomy.module</i> is an extremely flexible
|
||||
classification system that allows for multiple lists of categories for classification
|
||||
(controlled vocabularies) and offers the possibility of creating thesauri (controlled
|
||||
vocabularies that indicate the relationship of terms) and taxonomies (controlled
|
||||
vocabularies where relationships are indicated hierarchically). For details about
|
||||
<a href="http://www.eleganthack.com/archives/002165.html#002165">classification
|
||||
types</a> and insight into the development of <i>taxonomy.module</i>, see this
|
||||
<a href="http://www.drupal.org/node.php?id=55">drupal.org discussion</a>.<br />
|
||||
<h3>An Example Taxonomy - Foods</h3>
|
||||
<p>Dairy <br>
|
||||
--Milk <br>
|
||||
Drink <br>
|
||||
--Alchohol <br>
|
||||
--Pop <br>
|
||||
--Milk<br>
|
||||
Meat <br>
|
||||
--Beef <br>
|
||||
--Chicken <br>
|
||||
--Lamb <br>
|
||||
Spices <br>
|
||||
--Sugar</p>
|
||||
<p><b>Notes</b></p>
|
||||
<ul>
|
||||
<li>The term <i>Milk</i> appears within both <i>Dairy</i> and <i>Drink</i>.
|
||||
This is an example of <i>Multiple Parents</i> for a term.</li>
|
||||
<li>The order of siblings (e.g. <i>Beef</i>, <i>Chicken</i>, <i>Lamb</i>) in
|
||||
the taxonomy may be controlled with the <i>Weight</i> parameter. </li>
|
||||
</ul>
|
||||
<h4></h4>
|
||||
<h3>Vocabularies</h3>
|
||||
When you create a controlled vocabulary you are creating a set of terms to use
|
||||
for describing content (known as descriptors in indexing lingo). Drupal allows
|
||||
you to describe each node of content (blog, story, etc.)
|
||||
using one or many of these terms. For simple implementations, you might
|
||||
create a set of categories without subcategories, similar to <a href="http://www.slashdot.com">Slashdot's</a> "Sections".
|
||||
For more complex implementations, you might create a hierarchical list of categories
|
||||
such as the example <i>Food</i> taxonomy above.
|
||||
|
||||
<h4>Setting up a vocabulary</h4>
|
||||
<p>When you set up a controlled vocabulary, you will be asked to enter some descriptive
|
||||
data and define the attributes of this vocabulary. For example, if you select
|
||||
the <i>Hierarchy </i>option, you will be defining a taxonomy or a thesaurus. If
|
||||
you select <i>Related Terms</i> option, you are allowing the definition of related
|
||||
terms as in a thesaurus. Selecting <i>Multiple Select</i> will allow you to describe
|
||||
a node using more than one term. That node will then appear in each term's page,
|
||||
thus increasing the chance that a user will find it.</p>
|
||||
<i>Vocabulary name</i><br />
|
||||
Required. The name for this vocabulary. Example: <i>Dairy</i>.<br />
|
||||
<br />
|
||||
<i>Description</i><br />
|
||||
Optional. Description of the vocabulary, can be used by modules and feeds.<br />
|
||||
<br />
|
||||
<i>Types</i><br />
|
||||
Required. The list of node types you want to associate this vocabulary
|
||||
with. Some available types are: blog, book, forum, page, story.<br />
|
||||
<br />
|
||||
<i><a name="relatedterms"></a>Related Terms</i><br />
|
||||
Allows relationships between terms within this vocabulary. Think of these as
|
||||
<i>See also</i> references.<br />
|
||||
<br />
|
||||
<i><a name="hierarchy"></a>Hierarchy</i><br />
|
||||
Allows a tree-like taxonomy, as in our <i>Foods</i> example above<br />
|
||||
<br />
|
||||
<i>Multiple Select</i><br />
|
||||
Allows nodes to be described using more than one term. Nodes may then appear on
|
||||
multiple taxonomy pages.<br />
|
||||
<h4>Adding terms to a vocabulary</h4>
|
||||
The options you see when adding a term to a vocabulary will depend on what you
|
||||
selected for <i>Related Terms</i>, <i>Hierarchy </i>and <i>Multiple Select</i>
|
||||
when you created the corrosponding vocabulary.<br />
|
||||
<br />
|
||||
<i>Term name</i><br />
|
||||
Required. The name for this term. Example: <i>Milk</i><br />
|
||||
<br />
|
||||
<i>Description</i><br />
|
||||
Optional. Description of the term that may be used by modules and RSS feeds.
|
||||
This is synonymous with a 'Scope note'.<br />
|
||||
<br />
|
||||
<i><a name="parent"></a>Parent</i><br />
|
||||
Required. Select the term under which this term is a subset -- the branch of the hierarchy
|
||||
that this term belongs under. This is also known as the "Broader term" indicator
|
||||
used in thesauri.<br />
|
||||
<br />
|
||||
<i><a name="synonyms"></a>Synonyms</i><br />
|
||||
Optional. Enter synonyms for this term, one synonym per line. Synonyms can be used for
|
||||
variant spellings, acronyms, and other terms that have the same meaning as the
|
||||
added term, but which are not explicitly listed in this thesaurus (i.e. <i>unauthorized
|
||||
terms</i>).<br />
|
||||
|
||||
<h3>Displaying Nodes Organized by Term(s)</h3>
|
||||
<p>In order to view the nodes associated with a term or a collection of terms, you
|
||||
should browse to a properly formed URL. For example, see
|
||||
<a href="<?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "or" => "1,2"), "module"); ?></a>.
|
||||
Taxonomy URLs always contain a termID or list of termIDs at the end of the URL (aka <i>querystring</i>).
|
||||
You may learn the termID for a given term by hovering over that term in the <? echo la("Taxonomy Overview", array("mod" => "taxonomy")) ?> page in the Admin and noting the number after the querystring parameter called <i>tid</i>.
|
||||
If you wish to see nodes from a collection of termIDs, separate each termID with a comma.
|
||||
Also, the name of the querystring parameter may be <i>or</i> or <i>and</i>.
|
||||
<i>or</i> shows nodes which appear in <b>any</b> of the termIDs while <i>and</i> shows nodes in <b>all</b> the specified termIDs.
|
||||
Thus, <i>or</i> is less specific than <i>and</i>.
|
||||
</p>
|
||||
|
||||
<h3>RSS Feeds</h3>
|
||||
<p>Every term, or collection of terms, provides an <a href="http://backend.userland.com/stories/rss091">RSS</a> feed to which interested
|
||||
users may subscribe. The URL format for an sample RSS feed is
|
||||
<a href="<?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?>"><?php print path_uri().drupal_url(array("mod" => "node", "op" => "feed", "or" => "1,2"), "module"); ?></a>.</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -9,7 +9,7 @@ function tracker_help() {
|
|||
function tracker_link($type) {
|
||||
|
||||
if ($type == "menu.view") {
|
||||
$links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("view new comments") ."</a>";
|
||||
$links[] = lm(t("view new comments"), array("mod" => "tracker"), t("Display an overview of the recent comments."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -21,17 +21,17 @@ function tracker_comments($id = 0) {
|
|||
$period = time() - 259200; // all comments of the past 3 days
|
||||
|
||||
if ($id) {
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10");
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '%s' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10", $id);
|
||||
}
|
||||
else {
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10");
|
||||
}
|
||||
|
||||
while ($node = db_fetch_object($sresult)) {
|
||||
$output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n";
|
||||
$output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ".l(check_output($node->title), array("id" => $node->nid)).":\n";
|
||||
|
||||
if ($id) {
|
||||
$cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '". check_input($id) ."' AND nid = '$node->nid' ORDER BY cid DESC");
|
||||
$cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '%s' AND nid = '$node->nid' ORDER BY cid DESC", $id);
|
||||
}
|
||||
else {
|
||||
$cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.timestamp > $period AND c.nid = '$node->nid' ORDER BY c.cid DESC");
|
||||
|
@ -39,7 +39,7 @@ function tracker_comments($id = 0) {
|
|||
|
||||
$output .= "<ul>";
|
||||
while ($comment = db_fetch_object($cresult)) {
|
||||
$output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> by <a href=\"module.php?mod=user&op=view&id=$comment->uid\">". check_output($comment->name) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
|
||||
$output .= " <li>".l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid."#".$comment->cid))." by ".lm(check_output($comment->name), array("mod" => "user", "op" => "view", "id" => $comment->uid))." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
|
||||
}
|
||||
$output .= " </ul>\n";
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ function tracker_comments($id = 0) {
|
|||
function tracker_menu() {
|
||||
global $user;
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=tracker&id=$user->uid\" title=\"". t("Display an overview of your recent comments.") ."\">your recent comments</a>";
|
||||
$links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of all the recent comments.") ."\">all recent comments</a>";
|
||||
$links[] = lm(t("your recent comments"), array("mod" => "tracker", "id" => $user->uid), t("Display an overview of your recent comments."));
|
||||
$links[] = lm(t("all recent comments"), array("mod" => "tracker"), t("Display an overview of all the recent comments."));
|
||||
|
||||
return "<div align=\"center\">". implode(" · ", $links) ."</div>";
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ function tracker_help() {
|
|||
function tracker_link($type) {
|
||||
|
||||
if ($type == "menu.view") {
|
||||
$links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("view new comments") ."</a>";
|
||||
$links[] = lm(t("view new comments"), array("mod" => "tracker"), t("Display an overview of the recent comments."));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -21,17 +21,17 @@ function tracker_comments($id = 0) {
|
|||
$period = time() - 259200; // all comments of the past 3 days
|
||||
|
||||
if ($id) {
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '". check_input($id) ."' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10");
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '%s' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10", $id);
|
||||
}
|
||||
else {
|
||||
$sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10");
|
||||
}
|
||||
|
||||
while ($node = db_fetch_object($sresult)) {
|
||||
$output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." <a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a>:\n";
|
||||
$output .= format_plural($node->comments, "comment", "comments") ." ". t("attached to node") ." ".l(check_output($node->title), array("id" => $node->nid)).":\n";
|
||||
|
||||
if ($id) {
|
||||
$cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '". check_input($id) ."' AND nid = '$node->nid' ORDER BY cid DESC");
|
||||
$cresult = db_query("SELECT * FROM comments WHERE timestamp > $period AND uid = '%s' AND nid = '$node->nid' ORDER BY cid DESC", $id);
|
||||
}
|
||||
else {
|
||||
$cresult = db_query("SELECT c.*, u.name FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.timestamp > $period AND c.nid = '$node->nid' ORDER BY c.cid DESC");
|
||||
|
@ -39,7 +39,7 @@ function tracker_comments($id = 0) {
|
|||
|
||||
$output .= "<ul>";
|
||||
while ($comment = db_fetch_object($cresult)) {
|
||||
$output .= " <li><a href=\"node.php?id=$node->nid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</a> by <a href=\"module.php?mod=user&op=view&id=$comment->uid\">". check_output($comment->name) ."</a> (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
|
||||
$output .= " <li>".l(check_output($comment->subject), array("id" => $node->nid, "cid" => $comment->cid, "pid" => $comment->pid."#".$comment->cid))." by ".lm(check_output($comment->name), array("mod" => "user", "op" => "view", "id" => $comment->uid))." (". t("replies") .": ". comment_num_replies($comment->cid) .") ". (comment_is_new($comment) ? "<span style=\"color: red;\">*</span>" : "") ."</li>\n";
|
||||
}
|
||||
$output .= " </ul>\n";
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ function tracker_comments($id = 0) {
|
|||
function tracker_menu() {
|
||||
global $user;
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=tracker&id=$user->uid\" title=\"". t("Display an overview of your recent comments.") ."\">your recent comments</a>";
|
||||
$links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of all the recent comments.") ."\">all recent comments</a>";
|
||||
$links[] = lm(t("your recent comments"), array("mod" => "tracker", "id" => $user->uid), t("Display an overview of your recent comments."));
|
||||
$links[] = lm(t("all recent comments"), array("mod" => "tracker"), t("Display an overview of all the recent comments."));
|
||||
|
||||
return "<div align=\"center\">". implode(" · ", $links) ."</div>";
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ function sess_read($key) {
|
|||
function sess_write($key, $value) {
|
||||
global $HTTP_SERVER_VARS;
|
||||
|
||||
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS["REMOTE_ADDR"]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'");
|
||||
db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = '%s' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ function sess_write($key, $value) {
|
|||
function sess_destroy($key) {
|
||||
global $HTTP_SERVER_VARS;
|
||||
|
||||
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS["REMOTE_ADDR"]) ."', timestamp = '". time() ."', sid = '' WHERE sid = '$key'");
|
||||
db_query("UPDATE users SET hostname = '%s', timestamp = '%s', sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
|
||||
}
|
||||
|
||||
function sess_gc($lifetime) {
|
||||
|
@ -107,7 +107,7 @@ function user_save($account, $array = array()) {
|
|||
}
|
||||
$query .= "data = '". check_query(serialize($data)) ."', ";
|
||||
|
||||
db_query("UPDATE users SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
|
||||
db_query("UPDATE users SET $query timestamp = '%s' WHERE uid = '$account->uid'", time());
|
||||
|
||||
$user = user_load(array("uid" => $account->uid));
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ function user_validate_authmap($account, $authname, $module) {
|
|||
$result = db_query("SELECT COUNT(*) from authmap WHERE uid != '$account->uid' && authname = '$authname'");
|
||||
if (db_result($result) > 0) {
|
||||
$name = module_invoke($module, "info", "name");
|
||||
return strtr(t("The %u ID %s is already taken."), array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
|
||||
return t("The %u ID %s is already taken.", array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ function user_search($keys) {
|
|||
global $PHP_SELF;
|
||||
$result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
|
||||
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin") : drupal_url(array("mod" => "user", "op" => "view", "id" => $account->uid), "module")), "user" => $account->name);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
@ -471,26 +471,26 @@ function user_block() {
|
|||
$block[1]["subject"] = t("Log in");
|
||||
|
||||
$output .= "<div align=\"center\">\n";
|
||||
$output .= "<form action=\"module.php?mod=user&op=login\" method=\"post\">\n";
|
||||
$output .= "<form action=\"".drupal_url(array("mod" => "user", "op" => "login"), "module")."\" method=\"post\">\n";
|
||||
$output .= "<b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\" /><br />\n";
|
||||
$output .= "<b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" type=\"password\" /><br />\n";
|
||||
$output .= "<input name=\"edit[remember_me]\" type=\"checkbox\" />". t("Remember me") ."<br />\n";
|
||||
$output .= "<input type=\"submit\" value=\"". t("Log in") ."\" /><br />\n";
|
||||
$output .= "</div>\n";
|
||||
if (variable_get("account_register", 1)) {
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\" title=\"". t("Create a new user account.") ."\">". t("Register") ."</a>\n";
|
||||
$output .= "» ".lm(t("Register"), array("mod" => "user", "op" => "register"), t("Create a new user account."))."\n";
|
||||
}
|
||||
$output .= "<br \>» <a href=\"module.php?mod=user&op=password\" title=\"". t("Request new password via e-mail") . "\">" . t("New password") . "</a><br />";
|
||||
$output .= "<br \>» ".lm(t("New password"), array("mod" => "user", "op" => "password"), t("Request new password via e-mail"))."</a><br />";
|
||||
$output .= "</form>\n";
|
||||
|
||||
$block[1]["content"] = $output;
|
||||
}
|
||||
|
||||
$block[0]["info"] = t("User information");
|
||||
$block[0]["link"] = "module.php?mod=user";
|
||||
$block[0]["link"] = drupal_url(array("mod" => "user"), "module");
|
||||
|
||||
$block[1]["info"] = t("Log in");
|
||||
$block[1]["link"] = "module.php?mod=user";
|
||||
$block[1]["link"] = drupal_url(array("mod" => "user"), "module");
|
||||
|
||||
// Who's online block
|
||||
$time = 60 * 60; // minutes * seconds
|
||||
|
@ -501,7 +501,7 @@ function user_block() {
|
|||
if (db_num_rows($result)) {
|
||||
$output = "<ol>";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$output .= '<li><a href="module.php?mod=user&op=view&id='. $account->uid .'">'. (strlen($account->name) > 10 ? substr($account->name, 0, 10) . '...' : $account->name) .'</a></li>';
|
||||
$output .= '<li>'.lm((strlen($account->name) > 10 ? substr($account->name, 0, 10) . '...' : $account->name), array("mod" => "user", "op" => "view", "id" => $account->uid)).'</li>';
|
||||
}
|
||||
$output .= "</ol>";
|
||||
$block[2]["content"] = $output;
|
||||
|
@ -514,23 +514,23 @@ function user_block() {
|
|||
|
||||
function user_link($type) {
|
||||
if ($type == "page") {
|
||||
$links[] = "<a href=\"module.php?mod=user\" title=\"". t("Create a user account, request a new password or edit your account settings.") ."\">". t("user account") ."</a>";
|
||||
$links[] = lm(t("user account"), array("mod" => "user"), t("Create a user account, request a new password or edit your account settings."));
|
||||
}
|
||||
|
||||
if ($type == "menu.settings") {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=edit\" title=\"". t("View and edit your account information.") ."\">". t("edit account") ."</a>";
|
||||
$links[] = lm(t("edit account"), array("mod" => "user", "op" => "edit"), t("View and edit your account information."));
|
||||
}
|
||||
|
||||
if ($type == "menu.misc") {
|
||||
if (user_access("access administration pages")) {
|
||||
$links[] = "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a>";
|
||||
$links[] = la(t("administer %a", array("%a" => variable_get("site_name", "drupal"))));
|
||||
}
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=user&op=logout\" title=\"". t("Logout.") ."\">". t("logout") ."</a>";
|
||||
$links[] = lm(t("logout"), array("mod" => "user", "op" => "logout"), t("Logout."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer users")) {
|
||||
$links[] = "<a href=\"admin.php?mod=user\">user management</a>";
|
||||
$links[] = la(t("user management"), array("mod" => "user"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -594,7 +594,7 @@ function user_set_authmaps($account, $authmaps) {
|
|||
if ($value) {
|
||||
$result = db_query("SELECT COUNT(*) from authmap WHERE uid = '$account->uid' && module = '$module[1]'");
|
||||
if (db_result($result) == 0) {
|
||||
$result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('" . check_query($value) . "', '" . check_query($account->uid) . "', '" . check_query($module[1]) . "')");
|
||||
$result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', '%s', '%s')", $value, $account->uid, $module[1]);
|
||||
}
|
||||
else {
|
||||
$result = db_query("UPDATE authmap SET authname = '$value' WHERE uid = '$account->uid' && module = '$module[1]'");
|
||||
|
@ -634,7 +634,7 @@ function user_help_da() {
|
|||
on logging into %s in the same manner, and he will always be logged into the
|
||||
same account.</p>";
|
||||
|
||||
$output = strtr(t($output), array("%s" => $site));
|
||||
$output = t($output, array("%s" => $site));
|
||||
|
||||
foreach (module_list() as $module) {
|
||||
if (module_hook($module, "auth")) {
|
||||
|
@ -649,7 +649,7 @@ function user_help_da() {
|
|||
function user_auth_help_links() {
|
||||
foreach (module_list() as $module) {
|
||||
if (module_hook($module, "auth_help")) {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=help#$module\">". module_invoke($module, "info", "name") ."</a>";
|
||||
$links[] = lm(module_invoke($module, "info", "name"), array("mod" => "user", "op" => "help#$module"));
|
||||
}
|
||||
}
|
||||
return $links;
|
||||
|
@ -665,11 +665,11 @@ function user_login($edit = array()) {
|
|||
*/
|
||||
|
||||
if ($user->uid) {
|
||||
drupal_goto("module.php?mod=user");
|
||||
drupal_goto(drupal_url(array("mod" => "user"), "module"));
|
||||
}
|
||||
|
||||
if (user_deny("user", $edit["name"])) {
|
||||
$error = strtr(t("The name '%s' has been denied access."), array("%s" => $edit["name"]));
|
||||
$error = t("The name '%s' has been denied access.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["name"] && $edit["pass"]) {
|
||||
|
||||
|
@ -703,7 +703,7 @@ function user_login($edit = array()) {
|
|||
watchdog("user", "external load: $name@$server, module: " . key($result));
|
||||
}
|
||||
else {
|
||||
$error = strtr(t("Invalid password for %s."), array("%s" => "<i>$name@$server</i>"));
|
||||
$error = t("Invalid password for %s.", array("%s" => "<i>$name@$server</i>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,12 +751,12 @@ function user_login($edit = array()) {
|
|||
** information page if we can detect the referer page:
|
||||
*/
|
||||
|
||||
$url = $HTTP_REFERER ? $HTTP_REFERER : "module.php?mod=user&op=view";
|
||||
$url = $HTTP_REFERER ? $HTTP_REFERER : drupal_url(array("mod" => "user", "op" => "view"), "module");
|
||||
drupal_goto($url);
|
||||
}
|
||||
else {
|
||||
if (!$error) {
|
||||
$error = sprintf(t("Sorry. Unrecognized username or password. Have you %sforgotten your password%s?"), "<a href=\"module.php?mod=user&op=password\">", "</a>");
|
||||
$error = t("Sorry. Unrecognized username or password.")." ".lm(t("Have you forgotten your password?"), array("mod" => "user", "op" => "password"));
|
||||
}
|
||||
if ($server) {
|
||||
watchdog("user", "failed login for '$name@$server': $error");
|
||||
|
@ -779,12 +779,12 @@ function user_login($edit = array()) {
|
|||
** Display login form:
|
||||
*/
|
||||
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, strtr(t("Enter your %s username, or an ID from one of our affiliates: %a."), array("%s" => variable_get("site_name", "local"), "%a" => implode(", ", user_auth_help_links()))));
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your %s username, or an ID from one of our affiliates: %a.", array("%s" => variable_get("site_name", "local"), "%a" => implode(", ", user_auth_help_links()))));
|
||||
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
|
||||
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
|
||||
$output .= form_submit(t("Log in"));
|
||||
$output .= "<p>» <a href=\"module.php?mod=user&op=password\">" . t("E-mail new password") . "</a><br />";
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\">" . t("Create new account") . "</a></p>";
|
||||
$output .= "<p>» ".lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "<br />";
|
||||
$output .= "» " .lm(t("Create new account"), array("mod" => "user", "op" => "register")). "</p>";
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
@ -814,12 +814,12 @@ function user_logout() {
|
|||
function user_pass($edit = array()) {
|
||||
|
||||
if ($edit["name"]) {
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '". check_input($edit["name"]) . "'"));
|
||||
if (!$account) $error = strtr(t("Sorry. The username <i>%s</i> is not recognized."), array("%s" => $edit["name"]));
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '%s'", $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 mail = '". check_input($edit["mail"]) ."'"));
|
||||
if (!$account) $error = strtr(t("Sorry. The e-mail address <i>%s</i> is not recognized."), array("%s" => $edit["mail"]));
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE mail = '%s'", $edit["mail"]));
|
||||
if (!$account) $error = t("Sorry. The e-mail address <i>%s</i> is not recognized.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
if ($account) {
|
||||
|
||||
|
@ -839,7 +839,7 @@ function user_pass($edit = array()) {
|
|||
global $HTTP_HOST;
|
||||
$variables = array("%username" => $account->name, "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => $HTTP_HOST, "%mailto" => $account->mail);
|
||||
$subject = strtr(variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), $variables);
|
||||
$body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
|
||||
user_mail($account->mail, $subject, $body, $headers);
|
||||
|
||||
|
@ -862,8 +862,8 @@ function user_pass($edit = array()) {
|
|||
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64);
|
||||
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64);
|
||||
$output .= form_submit(t("E-mail new password"));
|
||||
$output .= "<p>» <a href=\"module.php?mod=user&op=login\">" . t("Log in") . "</a><br />";
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\">" . t("Create new account") . "</a></p>";
|
||||
$output .= "<p>» ".lm(t("Log in"), array("mod" =>user, "op" => "login"))."<br />";
|
||||
$output .= "» ".lm(t("Create new account"), array("mod" => "user", "op" => "register"))."</p>";
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ function user_register($edit = array()) {
|
|||
*/
|
||||
|
||||
if ($user->uid) {
|
||||
drupal_goto("module.php?mod=user&op=edit");
|
||||
drupal_goto(drupal_url(array("mod" => "user", "op" => "edit"), "module"));
|
||||
}
|
||||
|
||||
if ($edit["name"] && $edit["mail"]) {
|
||||
|
@ -888,16 +888,16 @@ function user_register($edit = array()) {
|
|||
// do nothing
|
||||
}
|
||||
else if (user_deny("user", $edit["name"])) {
|
||||
$error = strtr(t("The name '%s' has been denied access."), array("%s" => $edit["name"]));
|
||||
$error = t("The name '%s' has been denied access.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (user_deny("mail", $edit["mail"])) {
|
||||
$error = strtr(t("The e-mail address '%s' has been denied access."), array("%s" => $edit["mail"]));
|
||||
$error = t("The e-mail address '%s' has been denied access.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if (variable_get("user_register", 1) == 0) {
|
||||
$error = t("Public registrations have been disabled by the site administrator.");
|
||||
|
@ -940,7 +940,7 @@ function user_register($edit = array()) {
|
|||
|
||||
//the first user may login immediately, and receives a customized welcome email.
|
||||
if ($user->uid == 1) {
|
||||
user_mail($edit["mail"], strtr(t("drupal user account details for %s"), array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %utimodule.php?mod=user&op=edit\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\n--drupal"), $variables, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password
|
||||
$output .= "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via email, so please configure your email settings using the Administration pages.</p><p> Your password is <b>$pass</b>. You may change your password on the next page.</p><p>Please login below.</p>";
|
||||
$output .= form_hidden("name", $user->name);
|
||||
|
@ -951,7 +951,7 @@ function user_register($edit = array()) {
|
|||
else {
|
||||
global $HTTP_HOST;
|
||||
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
|
||||
$body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
return t("Your password and further instructions have been sent to your e-mail address.");
|
||||
}
|
||||
|
@ -966,7 +966,7 @@ function user_register($edit = array()) {
|
|||
$affiliates = user_auth_help_links();
|
||||
if (array_count_values($affiliates) > 1) {
|
||||
$affiliates = implode(", ", $affiliates);
|
||||
$output .= "<p>" . strtr(t("Note: If you have an account with one of our affiliates (%s), you may <a href=\"\module.php?mod=user&op=login\">login now</a> instead of registering."), array("%s" => $affiliates)) ."</p>";
|
||||
$output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ".lm("login now", array("mod" => "user", "op" => "login"))." instead of registering.", array("%s" => $affiliates)) ."</p>";
|
||||
}
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your prefered username: only letters, numbers and spaces are allowed."));
|
||||
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
|
||||
|
@ -1009,11 +1009,11 @@ function user_edit($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if ($user->uid) {
|
||||
foreach (module_list() as $module) {
|
||||
|
@ -1089,9 +1089,9 @@ function user_edit($edit = array()) {
|
|||
}
|
||||
|
||||
function user_menu() {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=view\">". t("view user information") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=user&op=edit\">". t("edit user information") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=user&op=delete\">". t("delete account") ."</a>";
|
||||
$links[] = lm(t("view user information"), array("mod" => "user", "op" => "view"));
|
||||
$links[] = lm(t("edit user information"), array("mod" => "user", "op" => "edit"));
|
||||
$links[] = lm(t("delete account"), array("mod" => "user", "op" => "delete"));
|
||||
|
||||
return "<div align=\"center\">". implode(" · ", $links) ."</div>";
|
||||
}
|
||||
|
@ -1208,9 +1208,9 @@ function user_conf_options() {
|
|||
$output .= form_select("Public registrations", "user_register", variable_get("user_register", 1), array("Only site administrators can create new user accounts.", "Visitors can create accounts and no administrator approval is required.", "Visitors can create accounts but administrator approval is required."));
|
||||
$output .= form_textfield("Password words", "user_password", variable_get("user_password", "foo,bar,guy,neo,tux,moo,sun,asm,dot,god,axe,geek,nerd,fish,hack,star,mice,warp,moon,hero,cola,girl,fish,java,perl,boss,dark,sith,jedi,drop,mojo"), 55, 256, "A comma separated list of short words that can be concatenated to generate human-readable passwords.");
|
||||
$output .= form_textfield("Welcome e-mail subject", "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), 80, 180, "Customize the Subject of your welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textfield("Forgotten password e-mail subject", "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, "Customize the Subject of your Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
@ -1250,11 +1250,11 @@ function user_admin_create($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else {
|
||||
$success = 1;
|
||||
|
@ -1287,7 +1287,7 @@ function user_admin_create($edit = array()) {
|
|||
function user_admin_access($edit = array()) {
|
||||
global $op, $id, $type;
|
||||
|
||||
$output .= "<small><a href=\"admin.php?mod=user&op=access&type=mail\">e-mail rules</a> :: <a href=\"admin.php?mod=user&op=access&type=user\">username rules</a></small><hr />";
|
||||
$output .= "<small>".la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail"))." :: ".la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user"))."</small><hr />"; // irc rules, too!
|
||||
|
||||
if ($type != "user") {
|
||||
$output .= "<h3>E-mail rules</h3>";
|
||||
|
@ -1298,7 +1298,7 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
|
||||
if ($op == "Add rule") {
|
||||
db_query("INSERT INTO access (mask, type, status) VALUES ('". check_input($edit["mask"]) ."', '". check_input($type) ."', '". check_input($edit["status"]) ."')");
|
||||
db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', '%s')", $edit["mask"], $type, $edit["status"]);
|
||||
}
|
||||
else if ($op == "Check") {
|
||||
if (user_deny($type, $edit["test"])) {
|
||||
|
@ -1315,16 +1315,16 @@ function user_admin_access($edit = array()) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>type</th><th>mask</th><th>operations</th></tr>";
|
||||
|
||||
$result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '1' ORDER BY mask");
|
||||
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
|
||||
|
||||
while ($rule = db_fetch_object($result)) {
|
||||
$output .= "<tr><td align=\"center\">allow</td><td>". check_output($rule->mask) ."</td><td><a href=\"admin.php?mod=user&op=access&type=$type&id=$rule->aid\">delete rule</a></td></tr>";
|
||||
$output .= "<tr><td align=\"center\">allow</td><td>". check_output($rule->mask) ."</td><td>".la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid))."</td></tr>";
|
||||
}
|
||||
|
||||
$result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '0' ORDER BY mask");
|
||||
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
|
||||
|
||||
while ($rule = db_fetch_object($result)) {
|
||||
$output .= "<tr><td align=\"center\">deny</td><td>". check_output($rule->mask) ."</td><td><a href=\"admin.php?mod=user&op=access&type=$type&id=$rule->aid\">delete rule</a></td></tr>";
|
||||
$output .= "<tr><td align=\"center\">deny</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)). "</td></tr>";
|
||||
}
|
||||
|
||||
$output .= " <tr><td><select name=\"edit[status]\"><option value=\"1\">allow</option><option value=\"0\">deny</option></select></td><td><input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add rule\" /></td></tr>";
|
||||
|
@ -1365,7 +1365,7 @@ function user_admin_perm($edit = array()) {
|
|||
$result = db_query("SELECT * FROM role");
|
||||
while ($role = db_fetch_object($result)) {
|
||||
$perm = $edit[$role->name] ? implode(", ", array_keys($edit[$role->name])) : "";
|
||||
db_query("UPDATE role SET perm = '$perm' WHERE name = '$role->name'");
|
||||
db_query("UPDATE role SET perm = '%s' WHERE name = '$role->name'", $perm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1415,13 +1415,13 @@ function user_admin_role($edit = array()) {
|
|||
global $op, $id;
|
||||
|
||||
if ($op == "Save role") {
|
||||
db_query("UPDATE role SET name = '". $edit["name"] ."' WHERE rid = '$id'");
|
||||
db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
|
||||
}
|
||||
else if ($op == "Delete role") {
|
||||
db_query("DELETE FROM role WHERE rid = '$id'");
|
||||
db_query("DELETE FROM role WHERE rid = '%s'", $id);
|
||||
}
|
||||
else if ($op == "Add role") {
|
||||
db_query("INSERT INTO role (name) VALUES ('". $edit["name"] ."')");
|
||||
db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
|
||||
}
|
||||
else if ($id) {
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ function user_admin_role($edit = array()) {
|
|||
** Display role form:
|
||||
*/
|
||||
|
||||
$role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '$id'"));
|
||||
$role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%s'", $id));
|
||||
|
||||
$output .= form_textfield("Role name", "name", $role->name, 32, 64, "The name for this role. Example: 'moderator', 'editorial board', 'site architect'.");
|
||||
$output .= form_submit("Save role");
|
||||
|
@ -1448,7 +1448,7 @@ function user_admin_role($edit = array()) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>name</th><th>operations</th></tr>";
|
||||
while ($role = db_fetch_object($result)) {
|
||||
$output .= "<tr><td>". check_output($role->name) ."</td><td><a href=\"admin.php?mod=user&op=role&id=$role->rid\">edit role</a></td></tr>";
|
||||
$output .= "<tr><td>". check_output($role->name) ."</td><td>".la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid))."</td></tr>";
|
||||
}
|
||||
$output .= " <tr><td><input size=\"32\" maxlength=\"64\" name=\"edit[name]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add role\" /></td></tr>";
|
||||
$output .= "</table>";
|
||||
|
@ -1484,11 +1484,11 @@ function user_admin_edit($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
if (!$error) {
|
||||
$account = user_save($account, $edit);
|
||||
|
@ -1560,7 +1560,7 @@ function user_admin_account() {
|
|||
$result = db_query("SELECT uid, name, timestamp FROM users ". $queries[$query ? $query : 0][0] ." LIMIT 50");
|
||||
|
||||
foreach ($queries as $key => $value) {
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=account&query=$key\">$value[1]</a>";
|
||||
$links[] = la($value[1], array("mod" => "user", "op" => "account", "query" => $key));
|
||||
}
|
||||
|
||||
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
|
||||
|
@ -1568,7 +1568,7 @@ function user_admin_account() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>username</th><th>last access</th><th>operations</th></tr>";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". format_name($account) ."</td><td>". format_date($account->timestamp, "small") ."</td><td align=\"center\"><a href=\"admin.php?mod=user&op=edit&id=$account->uid\">edit account</a></td></tr>";
|
||||
$output .= " <tr><td>". format_name($account) ."</td><td>". format_date($account->timestamp, "small") ."</td><td align=\"center\">".la(t("edit account"), array("mod" => "user", "op" => "edit", "id" =>$account->uid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
@ -1599,14 +1599,14 @@ function user_admin() {
|
|||
** Compile a list of the administrative links:
|
||||
*/
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=create\">add new user</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=access\">access rules</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=account\">user accounts</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=role\">user roles</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=permission\">user permissions</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=search\">search account</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=settings\">settings</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=help\">help</a>";
|
||||
$links[] = la(t("add new user"), array("mod" => "user", "op" => "create"));
|
||||
$links[] = la(t("access rules"), array("mod" => "user", "op" => "access"));
|
||||
$links[] = la(t("user accounts"), array("mod" => "user", "op" => "account"));
|
||||
$links[] = la(t("user roles"), array("mod" => "user", "op" => "role"));
|
||||
$links[] = la(t("user permissions"), array("mod" => "user", "op" => "permission"));
|
||||
$links[] = la(t("search account"), array("mod" => "user", "op" => "search"));
|
||||
$links[] = la(t("settings"), array("mod" => "user", "op" => "settings"));
|
||||
$links[] = la(t("help"), array("mod" => "user", "op" => "help"));
|
||||
|
||||
print "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ function user_admin() {
|
|||
print user_help();
|
||||
break;
|
||||
case "search":
|
||||
print search_type("user", "admin.php?mod=user&op=search");
|
||||
print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin"));
|
||||
break;
|
||||
case "Save configuration":
|
||||
case "Reset to defaults":
|
||||
|
|
|
@ -24,7 +24,7 @@ function sess_read($key) {
|
|||
function sess_write($key, $value) {
|
||||
global $HTTP_SERVER_VARS;
|
||||
|
||||
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS["REMOTE_ADDR"]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'");
|
||||
db_query("UPDATE users SET hostname = '%s', session = '%s', timestamp = '%s' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], $value, time());
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ function sess_write($key, $value) {
|
|||
function sess_destroy($key) {
|
||||
global $HTTP_SERVER_VARS;
|
||||
|
||||
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS["REMOTE_ADDR"]) ."', timestamp = '". time() ."', sid = '' WHERE sid = '$key'");
|
||||
db_query("UPDATE users SET hostname = '%s', timestamp = '%s', sid = '' WHERE sid = '$key'", $HTTP_SERVER_VARS["REMOTE_ADDR"], time());
|
||||
}
|
||||
|
||||
function sess_gc($lifetime) {
|
||||
|
@ -107,7 +107,7 @@ function user_save($account, $array = array()) {
|
|||
}
|
||||
$query .= "data = '". check_query(serialize($data)) ."', ";
|
||||
|
||||
db_query("UPDATE users SET $query timestamp = '". time() ."' WHERE uid = '$account->uid'");
|
||||
db_query("UPDATE users SET $query timestamp = '%s' WHERE uid = '$account->uid'", time());
|
||||
|
||||
$user = user_load(array("uid" => $account->uid));
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ function user_validate_authmap($account, $authname, $module) {
|
|||
$result = db_query("SELECT COUNT(*) from authmap WHERE uid != '$account->uid' && authname = '$authname'");
|
||||
if (db_result($result) > 0) {
|
||||
$name = module_invoke($module, "info", "name");
|
||||
return strtr(t("The %u ID %s is already taken."), array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
|
||||
return t("The %u ID %s is already taken.", array("%u" => ucfirst($name), "%s" => "<i>$authname</i>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ function user_search($keys) {
|
|||
global $PHP_SELF;
|
||||
$result = db_query("SELECT * FROM users WHERE name LIKE '%$keys%' LIMIT 20");
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name);
|
||||
$find[$i++] = array("title" => $account->name, "link" => (strstr($PHP_SELF, "admin.php") ? drupal_url(array("mod" => "user", "op" => "edit", "id" => $account->uid), "admin") : drupal_url(array("mod" => "user", "op" => "view", "id" => $account->uid), "module")), "user" => $account->name);
|
||||
}
|
||||
return $find;
|
||||
}
|
||||
|
@ -471,26 +471,26 @@ function user_block() {
|
|||
$block[1]["subject"] = t("Log in");
|
||||
|
||||
$output .= "<div align=\"center\">\n";
|
||||
$output .= "<form action=\"module.php?mod=user&op=login\" method=\"post\">\n";
|
||||
$output .= "<form action=\"".drupal_url(array("mod" => "user", "op" => "login"), "module")."\" method=\"post\">\n";
|
||||
$output .= "<b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\" /><br />\n";
|
||||
$output .= "<b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" type=\"password\" /><br />\n";
|
||||
$output .= "<input name=\"edit[remember_me]\" type=\"checkbox\" />". t("Remember me") ."<br />\n";
|
||||
$output .= "<input type=\"submit\" value=\"". t("Log in") ."\" /><br />\n";
|
||||
$output .= "</div>\n";
|
||||
if (variable_get("account_register", 1)) {
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\" title=\"". t("Create a new user account.") ."\">". t("Register") ."</a>\n";
|
||||
$output .= "» ".lm(t("Register"), array("mod" => "user", "op" => "register"), t("Create a new user account."))."\n";
|
||||
}
|
||||
$output .= "<br \>» <a href=\"module.php?mod=user&op=password\" title=\"". t("Request new password via e-mail") . "\">" . t("New password") . "</a><br />";
|
||||
$output .= "<br \>» ".lm(t("New password"), array("mod" => "user", "op" => "password"), t("Request new password via e-mail"))."</a><br />";
|
||||
$output .= "</form>\n";
|
||||
|
||||
$block[1]["content"] = $output;
|
||||
}
|
||||
|
||||
$block[0]["info"] = t("User information");
|
||||
$block[0]["link"] = "module.php?mod=user";
|
||||
$block[0]["link"] = drupal_url(array("mod" => "user"), "module");
|
||||
|
||||
$block[1]["info"] = t("Log in");
|
||||
$block[1]["link"] = "module.php?mod=user";
|
||||
$block[1]["link"] = drupal_url(array("mod" => "user"), "module");
|
||||
|
||||
// Who's online block
|
||||
$time = 60 * 60; // minutes * seconds
|
||||
|
@ -501,7 +501,7 @@ function user_block() {
|
|||
if (db_num_rows($result)) {
|
||||
$output = "<ol>";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$output .= '<li><a href="module.php?mod=user&op=view&id='. $account->uid .'">'. (strlen($account->name) > 10 ? substr($account->name, 0, 10) . '...' : $account->name) .'</a></li>';
|
||||
$output .= '<li>'.lm((strlen($account->name) > 10 ? substr($account->name, 0, 10) . '...' : $account->name), array("mod" => "user", "op" => "view", "id" => $account->uid)).'</li>';
|
||||
}
|
||||
$output .= "</ol>";
|
||||
$block[2]["content"] = $output;
|
||||
|
@ -514,23 +514,23 @@ function user_block() {
|
|||
|
||||
function user_link($type) {
|
||||
if ($type == "page") {
|
||||
$links[] = "<a href=\"module.php?mod=user\" title=\"". t("Create a user account, request a new password or edit your account settings.") ."\">". t("user account") ."</a>";
|
||||
$links[] = lm(t("user account"), array("mod" => "user"), t("Create a user account, request a new password or edit your account settings."));
|
||||
}
|
||||
|
||||
if ($type == "menu.settings") {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=edit\" title=\"". t("View and edit your account information.") ."\">". t("edit account") ."</a>";
|
||||
$links[] = lm(t("edit account"), array("mod" => "user", "op" => "edit"), t("View and edit your account information."));
|
||||
}
|
||||
|
||||
if ($type == "menu.misc") {
|
||||
if (user_access("access administration pages")) {
|
||||
$links[] = "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a>";
|
||||
$links[] = la(t("administer %a", array("%a" => variable_get("site_name", "drupal"))));
|
||||
}
|
||||
|
||||
$links[] = "<a href=\"module.php?mod=user&op=logout\" title=\"". t("Logout.") ."\">". t("logout") ."</a>";
|
||||
$links[] = lm(t("logout"), array("mod" => "user", "op" => "logout"), t("Logout."));
|
||||
}
|
||||
|
||||
if ($type == "admin" && user_access("administer users")) {
|
||||
$links[] = "<a href=\"admin.php?mod=user\">user management</a>";
|
||||
$links[] = la(t("user management"), array("mod" => "user"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -594,7 +594,7 @@ function user_set_authmaps($account, $authmaps) {
|
|||
if ($value) {
|
||||
$result = db_query("SELECT COUNT(*) from authmap WHERE uid = '$account->uid' && module = '$module[1]'");
|
||||
if (db_result($result) == 0) {
|
||||
$result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('" . check_query($value) . "', '" . check_query($account->uid) . "', '" . check_query($module[1]) . "')");
|
||||
$result = db_query("INSERT INTO authmap (authname, uid, module) VALUES ('%s', '%s', '%s')", $value, $account->uid, $module[1]);
|
||||
}
|
||||
else {
|
||||
$result = db_query("UPDATE authmap SET authname = '$value' WHERE uid = '$account->uid' && module = '$module[1]'");
|
||||
|
@ -634,7 +634,7 @@ function user_help_da() {
|
|||
on logging into %s in the same manner, and he will always be logged into the
|
||||
same account.</p>";
|
||||
|
||||
$output = strtr(t($output), array("%s" => $site));
|
||||
$output = t($output, array("%s" => $site));
|
||||
|
||||
foreach (module_list() as $module) {
|
||||
if (module_hook($module, "auth")) {
|
||||
|
@ -649,7 +649,7 @@ function user_help_da() {
|
|||
function user_auth_help_links() {
|
||||
foreach (module_list() as $module) {
|
||||
if (module_hook($module, "auth_help")) {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=help#$module\">". module_invoke($module, "info", "name") ."</a>";
|
||||
$links[] = lm(module_invoke($module, "info", "name"), array("mod" => "user", "op" => "help#$module"));
|
||||
}
|
||||
}
|
||||
return $links;
|
||||
|
@ -665,11 +665,11 @@ function user_login($edit = array()) {
|
|||
*/
|
||||
|
||||
if ($user->uid) {
|
||||
drupal_goto("module.php?mod=user");
|
||||
drupal_goto(drupal_url(array("mod" => "user"), "module"));
|
||||
}
|
||||
|
||||
if (user_deny("user", $edit["name"])) {
|
||||
$error = strtr(t("The name '%s' has been denied access."), array("%s" => $edit["name"]));
|
||||
$error = t("The name '%s' has been denied access.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["name"] && $edit["pass"]) {
|
||||
|
||||
|
@ -703,7 +703,7 @@ function user_login($edit = array()) {
|
|||
watchdog("user", "external load: $name@$server, module: " . key($result));
|
||||
}
|
||||
else {
|
||||
$error = strtr(t("Invalid password for %s."), array("%s" => "<i>$name@$server</i>"));
|
||||
$error = t("Invalid password for %s.", array("%s" => "<i>$name@$server</i>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,12 +751,12 @@ function user_login($edit = array()) {
|
|||
** information page if we can detect the referer page:
|
||||
*/
|
||||
|
||||
$url = $HTTP_REFERER ? $HTTP_REFERER : "module.php?mod=user&op=view";
|
||||
$url = $HTTP_REFERER ? $HTTP_REFERER : drupal_url(array("mod" => "user", "op" => "view"), "module");
|
||||
drupal_goto($url);
|
||||
}
|
||||
else {
|
||||
if (!$error) {
|
||||
$error = sprintf(t("Sorry. Unrecognized username or password. Have you %sforgotten your password%s?"), "<a href=\"module.php?mod=user&op=password\">", "</a>");
|
||||
$error = t("Sorry. Unrecognized username or password.")." ".lm(t("Have you forgotten your password?"), array("mod" => "user", "op" => "password"));
|
||||
}
|
||||
if ($server) {
|
||||
watchdog("user", "failed login for '$name@$server': $error");
|
||||
|
@ -779,12 +779,12 @@ function user_login($edit = array()) {
|
|||
** Display login form:
|
||||
*/
|
||||
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, strtr(t("Enter your %s username, or an ID from one of our affiliates: %a."), array("%s" => variable_get("site_name", "local"), "%a" => implode(", ", user_auth_help_links()))));
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your %s username, or an ID from one of our affiliates: %a.", array("%s" => variable_get("site_name", "local"), "%a" => implode(", ", user_auth_help_links()))));
|
||||
$output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username."));
|
||||
$output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0);
|
||||
$output .= form_submit(t("Log in"));
|
||||
$output .= "<p>» <a href=\"module.php?mod=user&op=password\">" . t("E-mail new password") . "</a><br />";
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\">" . t("Create new account") . "</a></p>";
|
||||
$output .= "<p>» ".lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "<br />";
|
||||
$output .= "» " .lm(t("Create new account"), array("mod" => "user", "op" => "register")). "</p>";
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
@ -814,12 +814,12 @@ function user_logout() {
|
|||
function user_pass($edit = array()) {
|
||||
|
||||
if ($edit["name"]) {
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '". check_input($edit["name"]) . "'"));
|
||||
if (!$account) $error = strtr(t("Sorry. The username <i>%s</i> is not recognized."), array("%s" => $edit["name"]));
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '%s'", $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 mail = '". check_input($edit["mail"]) ."'"));
|
||||
if (!$account) $error = strtr(t("Sorry. The e-mail address <i>%s</i> is not recognized."), array("%s" => $edit["mail"]));
|
||||
$account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE mail = '%s'", $edit["mail"]));
|
||||
if (!$account) $error = t("Sorry. The e-mail address <i>%s</i> is not recognized.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
if ($account) {
|
||||
|
||||
|
@ -839,7 +839,7 @@ function user_pass($edit = array()) {
|
|||
global $HTTP_HOST;
|
||||
$variables = array("%username" => $account->name, "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => $HTTP_HOST, "%mailto" => $account->mail);
|
||||
$subject = strtr(variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), $variables);
|
||||
$body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
|
||||
user_mail($account->mail, $subject, $body, $headers);
|
||||
|
||||
|
@ -862,8 +862,8 @@ function user_pass($edit = array()) {
|
|||
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64);
|
||||
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64);
|
||||
$output .= form_submit(t("E-mail new password"));
|
||||
$output .= "<p>» <a href=\"module.php?mod=user&op=login\">" . t("Log in") . "</a><br />";
|
||||
$output .= "» <a href=\"module.php?mod=user&op=register\">" . t("Create new account") . "</a></p>";
|
||||
$output .= "<p>» ".lm(t("Log in"), array("mod" =>user, "op" => "login"))."<br />";
|
||||
$output .= "» ".lm(t("Create new account"), array("mod" => "user", "op" => "register"))."</p>";
|
||||
|
||||
return form($output);
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ function user_register($edit = array()) {
|
|||
*/
|
||||
|
||||
if ($user->uid) {
|
||||
drupal_goto("module.php?mod=user&op=edit");
|
||||
drupal_goto(drupal_url(array("mod" => "user", "op" => "edit"), "module"));
|
||||
}
|
||||
|
||||
if ($edit["name"] && $edit["mail"]) {
|
||||
|
@ -888,16 +888,16 @@ function user_register($edit = array()) {
|
|||
// do nothing
|
||||
}
|
||||
else if (user_deny("user", $edit["name"])) {
|
||||
$error = strtr(t("The name '%s' has been denied access."), array("%s" => $edit["name"]));
|
||||
$error = t("The name '%s' has been denied access.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (user_deny("mail", $edit["mail"])) {
|
||||
$error = strtr(t("The e-mail address '%s' has been denied access."), array("%s" => $edit["mail"]));
|
||||
$error = t("The e-mail address '%s' has been denied access.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if (variable_get("user_register", 1) == 0) {
|
||||
$error = t("Public registrations have been disabled by the site administrator.");
|
||||
|
@ -940,7 +940,7 @@ function user_register($edit = array()) {
|
|||
|
||||
//the first user may login immediately, and receives a customized welcome email.
|
||||
if ($user->uid == 1) {
|
||||
user_mail($edit["mail"], strtr(t("drupal user account details for %s"), array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %utimodule.php?mod=user&op=edit\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\n--drupal"), $variables, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password
|
||||
$output .= "<p>Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via email, so please configure your email settings using the Administration pages.</p><p> Your password is <b>$pass</b>. You may change your password on the next page.</p><p>Please login below.</p>";
|
||||
$output .= form_hidden("name", $user->name);
|
||||
|
@ -951,7 +951,7 @@ function user_register($edit = array()) {
|
|||
else {
|
||||
global $HTTP_HOST;
|
||||
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
|
||||
$body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
$body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
|
||||
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
|
||||
return t("Your password and further instructions have been sent to your e-mail address.");
|
||||
}
|
||||
|
@ -966,7 +966,7 @@ function user_register($edit = array()) {
|
|||
$affiliates = user_auth_help_links();
|
||||
if (array_count_values($affiliates) > 1) {
|
||||
$affiliates = implode(", ", $affiliates);
|
||||
$output .= "<p>" . strtr(t("Note: If you have an account with one of our affiliates (%s), you may <a href=\"\module.php?mod=user&op=login\">login now</a> instead of registering."), array("%s" => $affiliates)) ."</p>";
|
||||
$output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ".lm("login now", array("mod" => "user", "op" => "login"))." instead of registering.", array("%s" => $affiliates)) ."</p>";
|
||||
}
|
||||
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your prefered username: only letters, numbers and spaces are allowed."));
|
||||
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
|
||||
|
@ -1009,11 +1009,11 @@ function user_edit($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else if ($user->uid) {
|
||||
foreach (module_list() as $module) {
|
||||
|
@ -1089,9 +1089,9 @@ function user_edit($edit = array()) {
|
|||
}
|
||||
|
||||
function user_menu() {
|
||||
$links[] = "<a href=\"module.php?mod=user&op=view\">". t("view user information") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=user&op=edit\">". t("edit user information") ."</a>";
|
||||
$links[] = "<a href=\"module.php?mod=user&op=delete\">". t("delete account") ."</a>";
|
||||
$links[] = lm(t("view user information"), array("mod" => "user", "op" => "view"));
|
||||
$links[] = lm(t("edit user information"), array("mod" => "user", "op" => "edit"));
|
||||
$links[] = lm(t("delete account"), array("mod" => "user", "op" => "delete"));
|
||||
|
||||
return "<div align=\"center\">". implode(" · ", $links) ."</div>";
|
||||
}
|
||||
|
@ -1208,9 +1208,9 @@ function user_conf_options() {
|
|||
$output .= form_select("Public registrations", "user_register", variable_get("user_register", 1), array("Only site administrators can create new user accounts.", "Visitors can create accounts and no administrator approval is required.", "Visitors can create accounts but administrator approval is required."));
|
||||
$output .= form_textfield("Password words", "user_password", variable_get("user_password", "foo,bar,guy,neo,tux,moo,sun,asm,dot,god,axe,geek,nerd,fish,hack,star,mice,warp,moon,hero,cola,girl,fish,java,perl,boss,dark,sith,jedi,drop,mojo"), 55, 256, "A comma separated list of short words that can be concatenated to generate human-readable passwords.");
|
||||
$output .= form_textfield("Welcome e-mail subject", "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), 80, 180, "Customize the Subject of your welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textfield("Forgotten password e-mail subject", "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, "Customize the Subject of your Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
$output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
@ -1250,11 +1250,11 @@ function user_admin_create($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
else {
|
||||
$success = 1;
|
||||
|
@ -1287,7 +1287,7 @@ function user_admin_create($edit = array()) {
|
|||
function user_admin_access($edit = array()) {
|
||||
global $op, $id, $type;
|
||||
|
||||
$output .= "<small><a href=\"admin.php?mod=user&op=access&type=mail\">e-mail rules</a> :: <a href=\"admin.php?mod=user&op=access&type=user\">username rules</a></small><hr />";
|
||||
$output .= "<small>".la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail"))." :: ".la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user"))."</small><hr />"; // irc rules, too!
|
||||
|
||||
if ($type != "user") {
|
||||
$output .= "<h3>E-mail rules</h3>";
|
||||
|
@ -1298,7 +1298,7 @@ function user_admin_access($edit = array()) {
|
|||
}
|
||||
|
||||
if ($op == "Add rule") {
|
||||
db_query("INSERT INTO access (mask, type, status) VALUES ('". check_input($edit["mask"]) ."', '". check_input($type) ."', '". check_input($edit["status"]) ."')");
|
||||
db_query("INSERT INTO access (mask, type, status) VALUES ('%s', '%s', '%s')", $edit["mask"], $type, $edit["status"]);
|
||||
}
|
||||
else if ($op == "Check") {
|
||||
if (user_deny($type, $edit["test"])) {
|
||||
|
@ -1315,16 +1315,16 @@ function user_admin_access($edit = array()) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>type</th><th>mask</th><th>operations</th></tr>";
|
||||
|
||||
$result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '1' ORDER BY mask");
|
||||
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
|
||||
|
||||
while ($rule = db_fetch_object($result)) {
|
||||
$output .= "<tr><td align=\"center\">allow</td><td>". check_output($rule->mask) ."</td><td><a href=\"admin.php?mod=user&op=access&type=$type&id=$rule->aid\">delete rule</a></td></tr>";
|
||||
$output .= "<tr><td align=\"center\">allow</td><td>". check_output($rule->mask) ."</td><td>".la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid))."</td></tr>";
|
||||
}
|
||||
|
||||
$result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '0' ORDER BY mask");
|
||||
$result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
|
||||
|
||||
while ($rule = db_fetch_object($result)) {
|
||||
$output .= "<tr><td align=\"center\">deny</td><td>". check_output($rule->mask) ."</td><td><a href=\"admin.php?mod=user&op=access&type=$type&id=$rule->aid\">delete rule</a></td></tr>";
|
||||
$output .= "<tr><td align=\"center\">deny</td><td>". check_output($rule->mask) ."</td><td>". la(t("delete rule"), array("mod" => "user", "op" => "access", "type" => $type, "id" => $rule->aid)). "</td></tr>";
|
||||
}
|
||||
|
||||
$output .= " <tr><td><select name=\"edit[status]\"><option value=\"1\">allow</option><option value=\"0\">deny</option></select></td><td><input size=\"32\" maxlength=\"64\" name=\"edit[mask]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add rule\" /></td></tr>";
|
||||
|
@ -1365,7 +1365,7 @@ function user_admin_perm($edit = array()) {
|
|||
$result = db_query("SELECT * FROM role");
|
||||
while ($role = db_fetch_object($result)) {
|
||||
$perm = $edit[$role->name] ? implode(", ", array_keys($edit[$role->name])) : "";
|
||||
db_query("UPDATE role SET perm = '$perm' WHERE name = '$role->name'");
|
||||
db_query("UPDATE role SET perm = '%s' WHERE name = '$role->name'", $perm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1415,13 +1415,13 @@ function user_admin_role($edit = array()) {
|
|||
global $op, $id;
|
||||
|
||||
if ($op == "Save role") {
|
||||
db_query("UPDATE role SET name = '". $edit["name"] ."' WHERE rid = '$id'");
|
||||
db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
|
||||
}
|
||||
else if ($op == "Delete role") {
|
||||
db_query("DELETE FROM role WHERE rid = '$id'");
|
||||
db_query("DELETE FROM role WHERE rid = '%s'", $id);
|
||||
}
|
||||
else if ($op == "Add role") {
|
||||
db_query("INSERT INTO role (name) VALUES ('". $edit["name"] ."')");
|
||||
db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
|
||||
}
|
||||
else if ($id) {
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ function user_admin_role($edit = array()) {
|
|||
** Display role form:
|
||||
*/
|
||||
|
||||
$role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '$id'"));
|
||||
$role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%s'", $id));
|
||||
|
||||
$output .= form_textfield("Role name", "name", $role->name, 32, 64, "The name for this role. Example: 'moderator', 'editorial board', 'site architect'.");
|
||||
$output .= form_submit("Save role");
|
||||
|
@ -1448,7 +1448,7 @@ function user_admin_role($edit = array()) {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>name</th><th>operations</th></tr>";
|
||||
while ($role = db_fetch_object($result)) {
|
||||
$output .= "<tr><td>". check_output($role->name) ."</td><td><a href=\"admin.php?mod=user&op=role&id=$role->rid\">edit role</a></td></tr>";
|
||||
$output .= "<tr><td>". check_output($role->name) ."</td><td>".la(t("edit role"), array("mod" => "user", "op" => "role", "id" => $role->rid))."</td></tr>";
|
||||
}
|
||||
$output .= " <tr><td><input size=\"32\" maxlength=\"64\" name=\"edit[name]\" /></td><td><input type=\"submit\" name=\"op\" value=\"Add role\" /></td></tr>";
|
||||
$output .= "</table>";
|
||||
|
@ -1484,11 +1484,11 @@ function user_admin_edit($edit = array()) {
|
|||
else if ($error = user_validate_mail($edit["mail"])) {
|
||||
// do nothing
|
||||
}
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
|
||||
$error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
|
||||
else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
|
||||
$error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
|
||||
}
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
|
||||
$error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
|
||||
else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$account->uid' AND LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
|
||||
$error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
|
||||
}
|
||||
if (!$error) {
|
||||
$account = user_save($account, $edit);
|
||||
|
@ -1560,7 +1560,7 @@ function user_admin_account() {
|
|||
$result = db_query("SELECT uid, name, timestamp FROM users ". $queries[$query ? $query : 0][0] ." LIMIT 50");
|
||||
|
||||
foreach ($queries as $key => $value) {
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=account&query=$key\">$value[1]</a>";
|
||||
$links[] = la($value[1], array("mod" => "user", "op" => "account", "query" => $key));
|
||||
}
|
||||
|
||||
$output .= "<small>". implode(" :: ", $links) ."</small><hr />";
|
||||
|
@ -1568,7 +1568,7 @@ function user_admin_account() {
|
|||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>username</th><th>last access</th><th>operations</th></tr>";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$output .= " <tr><td>". format_name($account) ."</td><td>". format_date($account->timestamp, "small") ."</td><td align=\"center\"><a href=\"admin.php?mod=user&op=edit&id=$account->uid\">edit account</a></td></tr>";
|
||||
$output .= " <tr><td>". format_name($account) ."</td><td>". format_date($account->timestamp, "small") ."</td><td align=\"center\">".la(t("edit account"), array("mod" => "user", "op" => "edit", "id" =>$account->uid))."</td></tr>";
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
|
@ -1599,14 +1599,14 @@ function user_admin() {
|
|||
** Compile a list of the administrative links:
|
||||
*/
|
||||
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=create\">add new user</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=access\">access rules</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=account\">user accounts</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=role\">user roles</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=permission\">user permissions</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=search\">search account</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=settings\">settings</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=user&op=help\">help</a>";
|
||||
$links[] = la(t("add new user"), array("mod" => "user", "op" => "create"));
|
||||
$links[] = la(t("access rules"), array("mod" => "user", "op" => "access"));
|
||||
$links[] = la(t("user accounts"), array("mod" => "user", "op" => "account"));
|
||||
$links[] = la(t("user roles"), array("mod" => "user", "op" => "role"));
|
||||
$links[] = la(t("user permissions"), array("mod" => "user", "op" => "permission"));
|
||||
$links[] = la(t("search account"), array("mod" => "user", "op" => "search"));
|
||||
$links[] = la(t("settings"), array("mod" => "user", "op" => "settings"));
|
||||
$links[] = la(t("help"), array("mod" => "user", "op" => "help"));
|
||||
|
||||
print "<small>". implode(" · ", $links) ."</small><hr />";
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ function user_admin() {
|
|||
print user_help();
|
||||
break;
|
||||
case "search":
|
||||
print search_type("user", "admin.php?mod=user&op=search");
|
||||
print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin"));
|
||||
break;
|
||||
case "Save configuration":
|
||||
case "Reset to defaults":
|
||||
|
|
|
@ -14,7 +14,7 @@ function watchdog_perm() {
|
|||
|
||||
function watchdog_link($type) {
|
||||
if ($type == "admin" && user_access("administer watchdog")) {
|
||||
$links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>";
|
||||
$links[] = la(t("watchdog"), array("mod" => "watchdog"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -40,7 +40,7 @@ function watchdog_overview($type) {
|
|||
$output .= " <tr><th>date</th><th>message</th><th>user</th><th>operations</th></tr>";
|
||||
while ($watchdog = db_fetch_object($result)) {
|
||||
if ($background = $color[$watchdog->type]) {
|
||||
$output .= " <tr bgcolor=\"$background\"><td>". format_date($watchdog->timestamp, "small") ."</td><td>". substr(check_output($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\"><a href=\"admin.php?mod=watchdog&op=view&id=$watchdog->wid\">details</a></td></tr>";
|
||||
$output .= " <tr bgcolor=\"$background\"><td>". format_date($watchdog->timestamp, "small") ."</td><td>". substr(check_output($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">".la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid))."</td></tr>";
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
@ -70,7 +70,16 @@ function watchdog_admin() {
|
|||
|
||||
if (user_access("administer watchdog")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=watchdog&type=user\">user messages</a> | <a href=\"admin.php?mod=watchdog&type=regular\">regular messages</a> | <a href=\"admin.php?mod=watchdog&type=special\">special messages</a> | <a href=\"admin.php?mod=watchdog&type=warning\">warning messages</a> | <a href=\"admin.php?mod=watchdog&type=error\">error messages</a> | <a href=\"admin.php?mod=watchdog&type=httpd\">httpd messages</a> | <a href=\"admin.php?mod=watchdog\">overview</a> | <a href=\"admin.php?mod=watchdog&op=help\">help</a></small><hr />";
|
||||
$links[] = la(t("user messages"), array("mod" => "watchdog", "type" => "user"));
|
||||
$links[] = la(t("regular messages"), array("mod" => "watchdog", "type" => "regular"));
|
||||
$links[] = la(t("special messages"), array("mod" => "watchdog", "type" => "special"));
|
||||
$links[] = la(t("warning messages"), array("mod" => "watchdog", "type" => "warning"));
|
||||
$links[] = la(t("error messages"), array("mod" => "watchdog", "type" => "error"));
|
||||
$links[] = la(t("httpd messages"), array("mod" => "watchdog", "type" => "httpd"));
|
||||
$links[] = la(t("overview"), array("mod" => "watchdog"));
|
||||
$links[] = la(t("help"), array("mod" => "watchdog", "op" => "help"));
|
||||
|
||||
print "<small>".implode(" | ", $links)."</small><hr />";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
|
|
@ -14,7 +14,7 @@ function watchdog_perm() {
|
|||
|
||||
function watchdog_link($type) {
|
||||
if ($type == "admin" && user_access("administer watchdog")) {
|
||||
$links[] = "<a href=\"admin.php?mod=watchdog\">watchdog</a>";
|
||||
$links[] = la(t("watchdog"), array("mod" => "watchdog"));
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
|
@ -40,7 +40,7 @@ function watchdog_overview($type) {
|
|||
$output .= " <tr><th>date</th><th>message</th><th>user</th><th>operations</th></tr>";
|
||||
while ($watchdog = db_fetch_object($result)) {
|
||||
if ($background = $color[$watchdog->type]) {
|
||||
$output .= " <tr bgcolor=\"$background\"><td>". format_date($watchdog->timestamp, "small") ."</td><td>". substr(check_output($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\"><a href=\"admin.php?mod=watchdog&op=view&id=$watchdog->wid\">details</a></td></tr>";
|
||||
$output .= " <tr bgcolor=\"$background\"><td>". format_date($watchdog->timestamp, "small") ."</td><td>". substr(check_output($watchdog->message), 0, 64) ."</td><td align=\"center\">". format_name($watchdog) ."</a></td><td align=\"center\">".la(t("details"), array("mod" => "watchdog", "op" => "view", "id" => $watchdog->wid))."</td></tr>";
|
||||
}
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
@ -70,7 +70,16 @@ function watchdog_admin() {
|
|||
|
||||
if (user_access("administer watchdog")) {
|
||||
|
||||
print "<small><a href=\"admin.php?mod=watchdog&type=user\">user messages</a> | <a href=\"admin.php?mod=watchdog&type=regular\">regular messages</a> | <a href=\"admin.php?mod=watchdog&type=special\">special messages</a> | <a href=\"admin.php?mod=watchdog&type=warning\">warning messages</a> | <a href=\"admin.php?mod=watchdog&type=error\">error messages</a> | <a href=\"admin.php?mod=watchdog&type=httpd\">httpd messages</a> | <a href=\"admin.php?mod=watchdog\">overview</a> | <a href=\"admin.php?mod=watchdog&op=help\">help</a></small><hr />";
|
||||
$links[] = la(t("user messages"), array("mod" => "watchdog", "type" => "user"));
|
||||
$links[] = la(t("regular messages"), array("mod" => "watchdog", "type" => "regular"));
|
||||
$links[] = la(t("special messages"), array("mod" => "watchdog", "type" => "special"));
|
||||
$links[] = la(t("warning messages"), array("mod" => "watchdog", "type" => "warning"));
|
||||
$links[] = la(t("error messages"), array("mod" => "watchdog", "type" => "error"));
|
||||
$links[] = la(t("httpd messages"), array("mod" => "watchdog", "type" => "httpd"));
|
||||
$links[] = la(t("overview"), array("mod" => "watchdog"));
|
||||
$links[] = la(t("help"), array("mod" => "watchdog", "op" => "help"));
|
||||
|
||||
print "<small>".implode(" | ", $links)."</small><hr />";
|
||||
|
||||
switch ($op) {
|
||||
case "help":
|
||||
|
|
2
node.php
2
node.php
|
@ -42,7 +42,7 @@ if ($number > 1) {
|
|||
|
||||
while ($node = db_fetch_object($result)) {
|
||||
if (node_access("view", $node)) {
|
||||
$output .= "<p><b><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></b><br /><small>$node->type - ". format_name($node) ." - ". format_date($node->ccreated, "small") ."</small></p>";
|
||||
$output .= "<p><b>".l(check_output($node->title), array("id" => $node->nid))."</b><br /><small>$node->type - ". format_name($node) ." - ". format_date($node->ccreated, "small") ."</small></p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
|
||||
print " <tr><td colspan=\"2\"><img src=\"themes/marvin/images/drop.gif\" alt=\"\" /> <b>". check_output($node->title) ."</b></td></tr>\n";
|
||||
print " <tr valign=\"bottom\"><td colspan=\"2\" bgcolor=\"#000000\" width=\"100%\"><img src=\"themes/marvin/images/pixel.gif\" width=\"1\" height=\"1\" alt=\"\" /></td></tr>\n";
|
||||
print " <tr><td nowrap=\"nowrap\"><font color=\"#7C7C7C\"><small>". strtr(t("Submitted by %a on %b"), array("%a" => format_name($node), "%b" => format_date($node->created, "large"))); ?><?php print "</small></font></td><td align=\"right\" valign=\"top\" nowrap=\"nowrap\"><small>". node_index($node) ."</small></td></tr>\n";
|
||||
print " <tr><td nowrap=\"nowrap\"><font color=\"#7C7C7C\"><small>". t("Submitted by %a on %b", array("%a" => format_name($node), "%b" => format_date($node->created, "large"))); ?><?php print "</small></font></td><td align=\"right\" valign=\"top\" nowrap=\"nowrap\"><small>". node_index($node) ."</small></td></tr>\n";
|
||||
print " <tr><td colspan=\"2\"> </td></tr>\n";
|
||||
|
||||
if ($main && $node->teaser) {
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<TR><TD COLSPAN="2" BGCOLOR="<?php echo $this->bgcolor1; ?>" WIDTH="100%"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><FONT COLOR="<?php echo $this->fgcolor1; ?>"><B><?php echo "". check_output($node->title) .""; ?></B></FONT></td><td valign="middle" align="center"><IMG SRC="themes/<?php print $this->themename; ?>/images/icon.gif" valign="middle"></td></tr></table></TD></TR>
|
||||
<TR BGCOLOR="<?php echo $this->bgcolor2; ?>">
|
||||
<?php
|
||||
print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . strtr(t("Submitted by %a on %b"), array("%a" => format_name($node), "%b" => format_date($node->created, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node) ."</B>";
|
||||
print "<TD WIDTH=\"70%\" BGCOLOR=\"$this->bgcolor2\"><SMALL>" . t("Submitted by %a on %b", array("%a" => format_name($node), "%b" => format_date($node->created, "large"))) . "</TD><TD WIDTH=\"30%\" BGCOLOR=\"$this->bgcolor2\" ALIGN=\"center\" NOWRAP><B>". node_index($node) ."</B>";
|
||||
?>
|
||||
</TD>
|
||||
</TR>
|
||||
|
|
Loading…
Reference in New Issue