aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2010-04-14 17:56:12 +0200
committerWojciech Polak <polak@gnu.org>2010-04-14 17:56:12 +0200
commit5a864878730d3b10fb92e37c9720739c7ac18eff (patch)
tree577c465a6706a81c755457e45a482b940af887c9
parentcdfad86f5c1dc24788b56318cfeaf4763213ef24 (diff)
downloadcheetah-5a864878730d3b10fb92e37c9720739c7ac18eff.tar.gz
cheetah-5a864878730d3b10fb92e37c9720739c7ac18eff.tar.bz2
Remove unused hash code in feeds.
-rw-r--r--frontend/import.php17
-rw-r--r--frontend/lib/feed.class.php5
-rw-r--r--sql/cheetah.sql1
3 files changed, 6 insertions, 17 deletions
diff --git a/frontend/import.php b/frontend/import.php
index 51da2fe..ebc7c57 100644
--- a/frontend/import.php
+++ b/frontend/import.php
@@ -1,11 +1,11 @@
<?php
/*
Cheetah News import.php
- Copyright (C) 2005, 2006 Wojciech Polak.
+ Copyright (C) 2005, 2006, 2010 Wojciech Polak.
Copyright (C) 2006 The Cheetah News Team.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
@@ -69,13 +69,12 @@ else {
}
class OPMLProcessor
{
var $isOPML = false;
var $feedId = -1;
- var $feedHash = '';
var $folderId = -1;
var $insideFeed = false;
var $insideFolder = false;
var $titleTag = false;
var $errorWriteFolder = false;
var $bloglinesExp = false;
@@ -146,23 +145,19 @@ class OPMLProcessor
$this->text = str_replace ("\n", ' ', $this->text);
if (isset ($attrs['xmlUrl'])) {
$this->xmlUrl = $this->db->escape ($attrs['xmlUrl']);
if ($this->xmlUrl[strlen ($this->xmlUrl) - 1] == '/') {
$this->xmlUrl = substr ($this->xmlUrl, 0, -1);
}
- $url_parts = parse_url ($this->xmlUrl);
- $url = $url_parts['host'].(!empty ($url_parts['path'])
- ? $url_parts['path'] : '');
- $this->feedHash = md5 ($url);
}
else
$this->xmlUrl = '';
if ($this->insideFolder) {
$this->insideFeed = true;
- if ($this->xmlUrl != '') { // feed w folderze
+ if ($this->xmlUrl != '') { // feed in folder
if (!preg_match ('/^http:\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
.'((:[0-9]{1,5})?\/.*)?$/i' , $this->xmlUrl))
return;
$exists = false;
@@ -175,14 +170,13 @@ class OPMLProcessor
$this->feedId."' AND userid='".$this->userId."'");
if ($this->db->next_record ()) {
$exists = true;
}
}
else {
- $this->db->query ("INSERT INTO feed SET hash='".
- $this->feedHash."', url='".
+ $this->db->query ("INSERT INTO feed SET url='".
$this->xmlUrl."'");
$this->db->query ("SELECT LAST_INSERT_ID() AS id FROM feed");
if ($this->db->next_record ()) {
$this->feedId = $this->db->f ('id');
}
else {
@@ -234,13 +228,13 @@ class OPMLProcessor
else {
$this->errorWriteFolder = true;
return;
}
}
}
- else { // feed bez folderu
+ else { // feed without a folder
$this->insideFeed = true;
if (!preg_match ('/^http:\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
.'((:[0-9]{1,5})?\/.*)?$/i' , $this->xmlUrl))
return;
@@ -255,14 +249,13 @@ class OPMLProcessor
if ($this->db->next_record ()) {
$exists = true;
return;
}
}
else {
- $this->db->query ("INSERT INTO feed SET hash='".
- $this->feedHash."', url='".$this->xmlUrl."'");
+ $this->db->query ("INSERT INTO feed SET url='".$this->xmlUrl."'");
$this->db->query ("SELECT LAST_INSERT_ID() AS id FROM feed");
if ($this->db->next_record ()) {
$this->feedId = $this->db->f ('id');
}
else {
return;
diff --git a/frontend/lib/feed.class.php b/frontend/lib/feed.class.php
index 8348170..4d3db53 100644
--- a/frontend/lib/feed.class.php
+++ b/frontend/lib/feed.class.php
@@ -20,24 +20,22 @@
require_once 'lib/feedparser.class.php';
class Feed
{
var $id;
- var $hash;
var $url;
var $lastModified;
var $eTag;
var $description;
var $isNewGlobal;
var $isCached;
function Feed ()
{
$this->id = null;
- $this->hash = null;
$this->url = null;
$this->lastModified = null;
$this->eTag = null;
$this->description = null;
$this->isNewGlobal = true;
$this->isCached = false;
@@ -276,20 +274,19 @@ class Feed
{
if ($this->url[strlen ($this->url) - 1] == '/') {
$this->url = substr ($this->url, 0, -1);
}
$url_parts = parse_url ($this->url);
$url = $url_parts['host'].(!empty ($url_parts['path']) ? $url_parts['path'] : '');
- $this->hash = md5 ($url);
if (empty ($this->description)) {
$this->description = $url;
}
$this->description = str_replace ("\n", ' ', $this->description);
- $db->query ("INSERT INTO feed SET hash='".$this->hash."', url='".$this->url."', ".
+ $db->query ("INSERT INTO feed SET url='".$this->url."', ".
"description='".$db->escape ($this->description)."'");
if ($db->affected_rows () == 1)
{
$db->query ("SELECT LAST_INSERT_ID() as lastId FROM feed");
if ($db->next_record ()) {
$this->id = $db->f ('lastId');
diff --git a/sql/cheetah.sql b/sql/cheetah.sql
index 6547751..2ed00ce 100644
--- a/sql/cheetah.sql
+++ b/sql/cheetah.sql
@@ -47,13 +47,12 @@ CREATE TABLE openid (
UNIQUE KEY identity (identity)
) ENGINE=InnoDB CHARSET=utf8;
-- DROP TABLE IF EXISTS feed;
CREATE TABLE feed (
id int(11) NOT NULL auto_increment,
- hash varchar(64) NOT NULL default '',
url varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8;
-- DROP TABLE IF EXISTS feedaddqueue;

Return to:

Send suggestions and report system problems to the System administrator.