diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-04-14 20:46:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-04-14 20:46:41 +0000 |
commit | d8cd54969c856531e002136f52bc52e7cbcbf49f (patch) | |
tree | 8af1ccc6b65d736855ffa81ce2fe3957725d44c6 /includes | |
parent | e5fd6713078d2db7145aac80b4743048a2432fc8 (diff) | |
download | brdo-d8cd54969c856531e002136f52bc52e7cbcbf49f.tar.gz brdo-d8cd54969c856531e002136f52bc52e7cbcbf49f.tar.bz2 |
- Added Marco's long-awaited taxonmy module and patches - a replacement
for the meta system. The patches add some extra functionality to the
comment system (for example, comments can be set read-only) and fix a
couple of small problems.
+ I integrated the required SQL updates from the varius *.mysql files
into the "update.php" script. Upgrading should be easy ...
+ I did not apply/commit the "user.diff" as requested by Marco ...
+ I didn't know what to do with "forum.module" and "forum2.module":
what do you want me to do with it Marco? Which one should go in?
+ Can we remove "node_index()" now; both from "node.module" and the
themes?
+ Thanks Marco!
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/includes/common.inc b/includes/common.inc index ce5b3a25c..1dd21263b 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -78,9 +78,13 @@ function object2array($node) { return $array; } -function path_uri() { +function path_uri($brief = 0) { global $HTTP_HOST, $REQUEST_URI; - return "http://". $HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")) ."/"; + $path = $HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")) ."/"; + if (!$brief) { + $path = "http://". $path; + } + return $path; } function path_img() { @@ -148,7 +152,7 @@ function variable_del($name) { * Format a single result entry of a search query: * * @param $item a single search result as returned by <module>_search of type - * array("count" => ..., "link" => ..., "title" => ..., + * array("count" => ..., "link" => ..., "title" => ..., * "user" => ..., "date" => ..., "keywords" => ...) * @param $type module type of this item */ @@ -164,14 +168,14 @@ function search_item($item, $type) { * Render a generic search form. * * "Generic" means "universal usable" - that is, usable not only from - * module.php?mod=search, but also as a simple seach box (without - * "Restrict search to", help text, etc) from theme's header etc. - * This means: provide options to only conditionally render certain + * module.php?mod=search, but also as a simple seach box (without + * "Restrict search to", help text, etc) from theme's header etc. + * This means: provide options to only conditionally render certain * parts of this form. * * @param $action Form action. Defaults to module.php?mod=search. * @param $query Query string. Defaults to global $keys. - * @param $options != 0: Render additional form fields/text + * @param $options != 0: Render additional form fields/text * ("Restrict search to", help text, etc). */ function search_form($action = 0, $query = 0, $options = 0) { @@ -239,11 +243,11 @@ function search_data() { /** * Display the search form and the resulting data. * - * @param $type If set, search only nodes of this type. + * @param $type If set, search only nodes of this type. * Otherwise, search all types. * @param $action Form action. Defaults to module.php?mod=search. * @param $query Query string. Defaults to global $keys. - * @param $options != 0: Render additional form fields/text + * @param $options != 0: Render additional form fields/text * ("Restrict search to", help text, etc). */ function search_type($type = 0, $action = 0, $query = 0, $options = 0) { @@ -256,6 +260,22 @@ function search_type($type = 0, $action = 0, $query = 0, $options = 0) { return search_form($action, $query, $options) . search_data(); } +function drupal_str_replace($from, $to, $subject) { + + /* + ** Multiple item replace which works for *all* PHP versions + ** (PHP 4.05+ supports this natively using similar syntax). + ** $from and $to should be same sized arrays, $subject is the + ** source text. + */ + + for ($i = 0; $i < count($from); $i++) { + $subject = str_replace($from[$i], $to[$i], $subject); + } + + return $subject; +} + function drupal_goto($url) { /* @@ -551,12 +571,12 @@ function form_textarea($title, $name, $value, $cols, $rows, $description = 0) { return form_item($title, "<textarea wrap=\"virtual\" cols=\"$cols\" rows=\"$rows\" name=\"edit[$name]\">". check_form($value) ."</textarea>", $description); } -function form_select($title, $name, $value, $options, $description = 0, $extra = 0) { +function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) { if (count($options) > 0) { - foreach ($options as $key => $choice) { + foreach ($options as $key=>$choice) { $select .= "<option value=\"$key\"". (is_array($value) ? (in_array($key, $value) ? " selected=\"selected\"" : "") : ($key == $value ? " selected=\"selected\"" : "")) .">". check_form($choice) ."</option>"; } - return form_item($title, "<select name=\"edit[$name]\"". ($extra ? " $extra" : "") .">$select</select>", $description); + return form_item($title, "<select name=\"edit[$name]".($multiple ? "[]" : "")."\"" .($multiple ? " multiple " : "").($extra ? " $extra" : "") .">$select</select>", $description); } } @@ -595,20 +615,20 @@ function field_merge($a, $b) { function link_page() { global $custom_links; - + if (is_array($custom_links)) { return $custom_links; } else { $links[] = "<a href=\"index.php\">". t("home") ."</a>"; - foreach (module_list() as $name) { + foreach (module_list() as $name) { if (module_hook($name, "link")) { $links = array_merge($links, module_invoke($name, "link", "page")); - } + } } return $links; } -} +} function link_node($node, $main = 0) { foreach (module_list() as $name) { |