Commit 63814764 authored by Dries's avatar Dries

- Two small bugfixes.
parent b885ccb8
......@@ -105,10 +105,10 @@ function import_feed_block($feed) {
}
function import_block() {
return import_block_bundle();
return import_get_bundles();
}
function import_block_bundle($attributes = 0) {
function import_get_bundles($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
......@@ -131,7 +131,6 @@ function import_block_bundle($attributes = 0) {
while ($bundle = db_fetch_object($result)) {
$i++;
$blocks[$i][subject] = format_url("module.php?mod=import&op=bundle&id=$bundle->bid", $bundle->title);
$blocks[$i][content] = import_bundle_block($bundle->attributes);
$blocks[$i][info] = "$bundle->title bundle";
......@@ -140,15 +139,15 @@ function import_block_bundle($attributes = 0) {
return $blocks;
}
function import_block_feed($attributes = 0) {
function import_get_feeds($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'";
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid");
}
else {
$result = db_query("SELECT * FROM feed ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed ORDER BY fid");
}
$i = 0;
......@@ -505,16 +504,16 @@ function import_page_bundle($bid) {
}
function import_page_bundles() {
import_page_blocks(import_block_bundle());
import_page_blocks(import_get_bundles());
}
function import_page_feeds() {
import_page_blocks(import_block_feed());
import_page_blocks(import_get_feeds());
}
function import_page_bundle_feeds($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
import_page_blocks(import_block_feed($bundle->attributes));
import_page_blocks(import_get_feeds($bundle->attributes));
}
function import_page_blocks($blocks) {
......
......@@ -105,10 +105,10 @@ function import_feed_block($feed) {
}
function import_block() {
return import_block_bundle();
return import_get_bundles();
}
function import_block_bundle($attributes = 0) {
function import_get_bundles($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
......@@ -131,7 +131,6 @@ function import_block_bundle($attributes = 0) {
while ($bundle = db_fetch_object($result)) {
$i++;
$blocks[$i][subject] = format_url("module.php?mod=import&op=bundle&id=$bundle->bid", $bundle->title);
$blocks[$i][content] = import_bundle_block($bundle->attributes);
$blocks[$i][info] = "$bundle->title bundle";
......@@ -140,15 +139,15 @@ function import_block_bundle($attributes = 0) {
return $blocks;
}
function import_block_feed($attributes = 0) {
function import_get_feeds($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'";
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid");
}
else {
$result = db_query("SELECT * FROM feed ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed ORDER BY fid");
}
$i = 0;
......@@ -505,16 +504,16 @@ function import_page_bundle($bid) {
}
function import_page_bundles() {
import_page_blocks(import_block_bundle());
import_page_blocks(import_get_bundles());
}
function import_page_feeds() {
import_page_blocks(import_block_feed());
import_page_blocks(import_get_feeds());
}
function import_page_bundle_feeds($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
import_page_blocks(import_block_feed($bundle->attributes));
import_page_blocks(import_get_feeds($bundle->attributes));
}
function import_page_blocks($blocks) {
......
......@@ -97,7 +97,7 @@ function blog_page_day($userid = 0, $date = 0) {
$output .= "<p>". blog_format_link($blog) . check_output($blog->body, 1) ."</p>\n";
}
if ($userid == $user->userid) {
if ($user->id && $user->userid == $userid) {
$output .= "<p>[ <a href=\"submit.php?mod=blog&op=edit&id=$first\">". t("edit") ."</a> ]</p>";
}
......@@ -122,7 +122,7 @@ function blog_format_link($blog) {
global $user;
if ($user && user_access("post blogs")) {
return "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\"><img src=\"misc/blog.gif\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\"></a>";
return "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\"><img src=\"misc/blog.gif\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\"></a> ";
}
}
......@@ -148,7 +148,7 @@ function blog_form($edit = array()) {
global $REQUEST_URI, $id, $mod, $type, $user, $theme;
if ($user->id) {
if ($mod == "node" || $edit[type] == "blog") {
}
else if ($type == "blog") {
......@@ -165,12 +165,12 @@ function blog_form($edit = array()) {
if ($edit[title]) {
$form .= blog_view(new Blog(node_preview($edit)));
}
$form .= form_textfield(t("Subject"), "title", $edit["title"], 50, 64);
$form .= form_textarea(t("Body"), "body", $edit["body"], 70, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_hidden("type", "blog");
if ($edit["nid"] > 0) {
$form .= form_hidden("nid", $edit["nid"]);
}
......@@ -187,9 +187,9 @@ function blog_form($edit = array()) {
$form .= form_submit(t("Preview"));
$form .= form_submit(t("Submit"));
}
$output .= form($REQUEST_URI, $form);
return $output;
}
else {
......
......@@ -97,7 +97,7 @@ function blog_page_day($userid = 0, $date = 0) {
$output .= "<p>". blog_format_link($blog) . check_output($blog->body, 1) ."</p>\n";
}
if ($userid == $user->userid) {
if ($user->id && $user->userid == $userid) {
$output .= "<p>[ <a href=\"submit.php?mod=blog&op=edit&id=$first\">". t("edit") ."</a> ]</p>";
}
......@@ -122,7 +122,7 @@ function blog_format_link($blog) {
global $user;
if ($user && user_access("post blogs")) {
return "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\"><img src=\"misc/blog.gif\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\"></a>";
return "<a href=\"submit.php?mod=blog&type=blog&id=$blog->nid\"><img src=\"misc/blog.gif\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\"></a> ";
}
}
......@@ -148,7 +148,7 @@ function blog_form($edit = array()) {
global $REQUEST_URI, $id, $mod, $type, $user, $theme;
if ($user->id) {
if ($mod == "node" || $edit[type] == "blog") {
}
else if ($type == "blog") {
......@@ -165,12 +165,12 @@ function blog_form($edit = array()) {
if ($edit[title]) {
$form .= blog_view(new Blog(node_preview($edit)));
}
$form .= form_textfield(t("Subject"), "title", $edit["title"], 50, 64);
$form .= form_textarea(t("Body"), "body", $edit["body"], 70, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_hidden("type", "blog");
if ($edit["nid"] > 0) {
$form .= form_hidden("nid", $edit["nid"]);
}
......@@ -187,9 +187,9 @@ function blog_form($edit = array()) {
$form .= form_submit(t("Preview"));
$form .= form_submit(t("Submit"));
}
$output .= form($REQUEST_URI, $form);
return $output;
}
else {
......
......@@ -105,10 +105,10 @@ function import_feed_block($feed) {
}
function import_block() {
return import_block_bundle();
return import_get_bundles();
}
function import_block_bundle($attributes = 0) {
function import_get_bundles($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
......@@ -131,7 +131,6 @@ function import_block_bundle($attributes = 0) {
while ($bundle = db_fetch_object($result)) {
$i++;
$blocks[$i][subject] = format_url("module.php?mod=import&op=bundle&id=$bundle->bid", $bundle->title);
$blocks[$i][content] = import_bundle_block($bundle->attributes);
$blocks[$i][info] = "$bundle->title bundle";
......@@ -140,15 +139,15 @@ function import_block_bundle($attributes = 0) {
return $blocks;
}
function import_block_feed($attributes = 0) {
function import_get_feeds($attributes = 0) {
if ($attributes) {
$keys = explode(",", $attributes);
foreach ($keys as $key) $where[] = "attributes LIKE '%". trim($key) ."%'";
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed WHERE ". implode(" OR ", $where) ." ORDER BY fid");
}
else {
$result = db_query("SELECT * FROM feed ORDER BY fid LIMIT ". variable_get("import_block_limit", 15));
$result = db_query("SELECT * FROM feed ORDER BY fid");
}
$i = 0;
......@@ -505,16 +504,16 @@ function import_page_bundle($bid) {
}
function import_page_bundles() {
import_page_blocks(import_block_bundle());
import_page_blocks(import_get_bundles());
}
function import_page_feeds() {
import_page_blocks(import_block_feed());
import_page_blocks(import_get_feeds());
}
function import_page_bundle_feeds($bid) {
$bundle = db_fetch_object(db_query("SELECT * FROM bundle WHERE bid = '". check_input($bid) ."'"));
import_page_blocks(import_block_feed($bundle->attributes));
import_page_blocks(import_get_feeds($bundle->attributes));
}
function import_page_blocks($blocks) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment