Commit cd48b94a authored by Dries's avatar Dries

- import.module:
    + applied Julian's fputs() patch
    + fixed typo

- cloud.module:
    + applied Julian's fputs() patch

- comment.module:
    + applied Julian's "delete" patch
parent 2e8763ba
......@@ -144,7 +144,7 @@ function import_refresh($feed) {
if ($fp) {
// fetch data:
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: ". variable_get("site_name", "drupal") ."\nHost: $url[host]\nAccept: */*\n\n");
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\r\nUser-Agent: ". variable_get("site_name", "drupal") ."\r\nHost: $url[host]\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) $data .= fgets($fp, 128);
......@@ -202,12 +202,12 @@ function import_refresh($feed) {
** Strip invalid tags and provide default values (if required):
*/
$title = strip_tags(strtr($title[1] ? $title[1] : $feed[title], $tt));$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$link = $link[1] ? $link[1] : $feed[link];
$description = strtr($description[1], $tt);
// print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
/*
** Save this item:
*/
......
......@@ -144,7 +144,7 @@ function import_refresh($feed) {
if ($fp) {
// fetch data:
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: ". variable_get("site_name", "drupal") ."\nHost: $url[host]\nAccept: */*\n\n");
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\r\nUser-Agent: ". variable_get("site_name", "drupal") ."\r\nHost: $url[host]\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) $data .= fgets($fp, 128);
......@@ -202,12 +202,12 @@ function import_refresh($feed) {
** Strip invalid tags and provide default values (if required):
*/
$title = strip_tags(strtr($title[1] ? $title[1] : $feed[title], $tt));$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$link = $link[1] ? $link[1] : $feed[link];
$description = strtr($description[1], $tt);
// print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
/*
** Save this item:
*/
......
......@@ -55,7 +55,8 @@ function cloud_update($site) {
if ($fp) {
// fetch data:
fputs($fp, "GET $link[path]?$link[query] HTTP/1.0\nUser-Agent: ". variable_get(site_name, "drupal") ."\nHost: $link[host]\nAccept: */*\n\n");
fputs($fp, "GET $link[path]?$link[query] HTTP/1.0\r\nUser-Agent: ". variable_get(site_name, "drupal") ."\r\nHost: $link[host]\r\nAccept: */*\r\n\r\n");
while(!feof($fp)) $data .= fgets($fp, 128);
if (strstr($data, "200 OK")) {
......
......@@ -53,6 +53,11 @@ function comment_overview() {
return $output;
}
function comment_delete($id) {
db_query("DELETE FROM comments WHERE cid = '$id'");
watchdog("special", "comment: deleted '$id'");
}
function comment_admin() {
global $op, $id, $edit, $mod, $keys, $order;
......@@ -68,6 +73,10 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "delete":
print comment_delete(check_input($id));
print comment_overview();
break;
case t("Submit"):
print status(comment_save(check_input($id), $edit));
print comment_overview();
......
......@@ -53,6 +53,11 @@ function comment_overview() {
return $output;
}
function comment_delete($id) {
db_query("DELETE FROM comments WHERE cid = '$id'");
watchdog("special", "comment: deleted '$id'");
}
function comment_admin() {
global $op, $id, $edit, $mod, $keys, $order;
......@@ -68,6 +73,10 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "delete":
print comment_delete(check_input($id));
print comment_overview();
break;
case t("Submit"):
print status(comment_save(check_input($id), $edit));
print comment_overview();
......
......@@ -144,7 +144,7 @@ function import_refresh($feed) {
if ($fp) {
// fetch data:
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\nUser-Agent: ". variable_get("site_name", "drupal") ."\nHost: $url[host]\nAccept: */*\n\n");
fputs($fp, "GET $url[path]?$url[query] HTTP/1.0\r\nUser-Agent: ". variable_get("site_name", "drupal") ."\r\nHost: $url[host]\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) $data .= fgets($fp, 128);
......@@ -202,12 +202,12 @@ function import_refresh($feed) {
** Strip invalid tags and provide default values (if required):
*/
$title = strip_tags(strtr($title[1] ? $title[1] : $feed[title], $tt));$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$title = strip_tags(strtr($title[1] ? $title[1] : substr(strip_tags(strtr($description[1], $tt)), 0, 30), $tt));
$link = $link[1] ? $link[1] : $feed[link];
$description = strtr($description[1], $tt);
// print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
print "<pre>title = ". htmlentities($title) ."\n\ndescription = ". htmlentities($description) ."\n\nlink = ". htmlentities($link) ."</pre><hr />";
/*
** Save this item:
*/
......
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