Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: sNews1.4-txtdb - Bugs by Albert  (Read 8285 times)

albert

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 405
    • http://www.oswt.co.uk/
sNews1.4-txtdb - Bugs by Albert
« on: March 11, 2006, 11:04:07 AM »

Hi All

Little Bugs I found: sNews1.4-txtdb

Articals: If you have already posted an artcal like 2 days ago and you go back to change today, be carefull.
If you choose Advanced the date will show 2 days ago.

That would mean you would have turned that Artcal into Future posting :)

Question should that not how todays date when you go to ajust the artical ?


Articals Code:
Missing an
Quote
images/arrow.gif
code there.

function menu_items():

do the links how up on the left as the supose to when you add Display as menu item ?

my code
Code: [Select]
///////////////////////////////////////////////////////////////////////////////////////////////
// DISPLAY MENU ITEMS = left
function menu_items() {

echo " }

thats it for Now

Albert



 
Logged
Albert
http://snews.awddesign.co.uk/snews/ site: v1.3
http://snews.awddesign.co.uk/           site: v1.2 http://www.awddesign.co.uk/
“Putting together the largest collection of sNews 1.5 designs. Coming very soon :)

Rod

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 78
    • http://www.rjs-custom.com
sNews1.4-txtdb - Bugs by Albert
« Reply #1 on: March 11, 2006, 03:32:16 PM »

Other interesting bugs/annoyances by dobey

1.

If you get the mysql_real_escape_string error, replace line 306 in snews-txtdb.php with this

Code: [Select]
$query = mysql_real_escape_string(addslashes($query));
with

Code: [Select]
$query = ereg_replace("['"\]","\\0",$query);

2.

showing of articles in category numbers when they are unpublished should be fixed by this.


line: 527

change
Code: [Select]
$calc_num_query = "SELECT * FROM " .s('prefix'). "articles WHERE position = 1 AND category = $r[id]";
to this
Code: [Select]
$calc_num_query = "SELECT * FROM " .s('prefix'). "articles WHERE position = 1 AND published <> 0 AND category = $r[id]";

That stops the article from being counted when it is not published or future posted.

3. If you try to delete the inc/dbs folder and it doesn't work, save this is in the snews root folder, and modify the prefix if necessary, and open it in a browser.  The articles will be completely removed and then you can remove the snews folder.

*** THIS WILL TOTALLY REMOVE/DELETE THE ENTIRE TXTDB DATABASE OF YOUR SNEWS SITE ***

Code: [Select]

function s($variable) {
$s = Array();

// Database prefix
$s['prefix'] = "";

return $s[$variable];
}

// remove articles
@unlink("./inc/dbs/".s('prefix')."articles.txt");

// remove categories
@unlink("./inc/dbs/".s('prefix')."categories.txt");

// remove comments
@unlink("./inc/dbs/".s('prefix')."comments.txt");

?>

cheers
Logged
Whatever went wrong, I am pretty sure I didn't do it!  Well atleast I think I didn't do it...

Rod

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 78
    • http://www.rjs-custom.com
sNews1.4-txtdb - Bugs by Albert
« Reply #2 on: March 15, 2006, 04:03:16 PM »

Quick fix for the error when article does not exist or sNews404

open /inc/api/cont.php and change line 37

This ->
Code: [Select]
$PRINT_ERRORS=1;To this ->
Code: [Select]
$PRINT_ERRORS=0;
save the file, now open snews-txtdb.php and at line 704

look for
Code: [Select]
if (isset($shorten) == 0) { $shorten = 9999000; }
}
$result = $db->query($query);
and change it to this
Code: [Select]
if (isset($shorten) == 0) { $shorten = 9999000; }
}
$result = $db->query($query);
if ($result == "") {
echo "

Something went wrong!

I couldn't find that article.
Are you sure the article exists?
Try searching for it to make sure.

";
} else {
Now go to line 799 and just before
Code: [Select]
if ($article <> "" AND $commentable =="YES") { comment("unfreezed"); }
add
Code: [Select]
}
Now save the file and try to enter a sefurl that doesn't exist and you will be given a message saying the article doesn't exist and to try searching for it instead

As far as I know, this only works for the flatfile version since it is a little less forgiving than the MySQL version for empty queries, Matt's fix won't work

A working example can be found at www.rjs-custom.com

cheers
Logged
Whatever went wrong, I am pretty sure I didn't do it!  Well atleast I think I didn't do it...

tim0fee

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
sNews1.4-txtdb - Bugs by Albert
« Reply #3 on: March 15, 2006, 11:19:28 PM »

Heya dobey,

Howzit ?

Is this a fix I should be using for my Mac/Safari/Firefox vanishing-trick problems ?

safe.

tim0fee
Logged

Rod

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 78
    • http://www.rjs-custom.com
sNews1.4-txtdb - Bugs by Albert
« Reply #4 on: March 16, 2006, 02:17:06 AM »

You could try, but no promises, for now afaik it is only for when to enter an url like

http://www.rjs-custom.com/home2/

Try the link and see, I am stil working on the Mac thing, and will try to have this resolved soon. ;)

cheers
Logged
Whatever went wrong, I am pretty sure I didn't do it!  Well atleast I think I didn't do it...

tim0fee

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
sNews1.4-txtdb - Bugs by Albert
« Reply #5 on: March 16, 2006, 01:08:13 PM »

Word!

I'll sit tight for now!

Thanks dobey dude.

tim0fee
Logged

tim0fee

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 71
sNews1.4-txtdb - Bugs by Albert
« Reply #6 on: May 01, 2006, 09:22:43 AM »

Wooooot!!!

dobey rox my sox!!

 ;D

tim0fee
Logged

Rod

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 78
    • http://www.rjs-custom.com
sNews1.4-txtdb - Bugs by Albert
« Reply #7 on: May 05, 2006, 05:51:47 PM »

The real future_posting bug fix.

Here is the real future posting bug fix, since the txtdb api remove zero's from the date, replce the update_articles function with this:

Code: [Select]
// UPDATE ARTICLES (FUTURE POSTING)
function update_articles() {
$db = new Database(s('dbname')) or die(s('dberror'));
$sql_date = $db->query("SELECT * FROM ".s('prefix')."articles WHERE published = 0");
$date_rows = $sql_date->num_rows();
if ($date_rows != '') {
$date = date('Y-').str_replace('0', '', date('m-d'))." ".str_replace('0', '', date('H:i:s'));
$db->query("UPDATE ".s('prefix')."articles SET published = 1 WHERE published = 0 and date <= '" . $date . "'");
}
}
cheers
Logged
Whatever went wrong, I am pretty sure I didn't do it!  Well atleast I think I didn't do it...

Aku

  • Guest
sNews1.4-txtdb - Bugs by Albert
« Reply #8 on: May 29, 2006, 01:39:57 PM »

If you get the mysql_real_escape_string error, replace line 306 in snews-txtdb.php with this

Code:

$query = mysql_real_escape_string(addslashes($query));

with

Code:

$query = ereg_replace("['"\]","\\0",$query);

---------------------------------------------------

I'm writing in regard to this bugfix. When I've done it like You wrote, I got an error:

---------------------------------------------------

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/szop/public_html/nwk/snews-txtdb.php on line 306

Parse error: parse error, unexpected ']' in /home/szop/public_html/nwk/snews-txtdb.php on line 306

---------------------------------------------------

Then I've tried to repair it, and for now I think that correct fix is:

---------------------------------------------------

If you get the mysql_real_escape_string error, replace line 306 in snews-txtdb.php with this

Code:

$query = mysql_real_escape_string(addslashes($query));

with

Code:

$query = ereg_replace("[''\]","\\0",$query);

---------------------------------------------------

It seems, that my problem was the " after $query = ereg_replace("['

EDIT: nope, that's not right fix.. now I'm getting no error but can't see new posts at all :/
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
sNews1.4-txtdb - Bugs by Albert
« Reply #9 on: August 30, 2006, 12:56:04 PM »

I have fiddled, and I think this is what Dobey was trying to have replaced... perhaps.
Quote
$query = ereg_replace("['\"]","\\0",$query);
The first forward slash was in wrong place. .. I hope.

Anyway, it is working for me now.
Logged
Of all the things I have lost, it is my mind that I miss the most.