Dragonfly CMS v9 ⇒ Gamers Modules & Blocks :: Archives ⇒ Creating a module RSS feed. Getting security error. :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum Index Modules & Blocks Gamers Modules & Blocks ⇒ Archives

Archived ⇒ Creating a module RSS feed. Getting security error.


NanoCaiordo wrote
database error -> db layer try to send an email using send_mail() -> send_mail() will then use is_mail() -> is_mail() will require the Security class.

If you use a working query then all this would not happen.
Quite adequately explained by Nano - you're adding a bandaid that masks the issue that caused the problem, which is pointless.

DonationsPro for DragonflyCMS & SMF

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Right, I see what you are saying but wouldn't that just send him a db error in his email so he could solve the issue anyways?

Scetter.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/2.2.20/5.1.61-log/5.3.8/9.3.3.1


scetter I'm not sure if what you are trying to suggest is that when developing a script that use sql queries we need to rely on our email box to see for any db errors while writing the query?

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


No sorry that is not what I was saying.
I was just stating that in order for that class to be used the file needed to be included.

But eigther way djdevon's question is being answered and that is all I was triing to do was help.

At any rate,
Glad to see you are getting it going djd.

We all learn something new every day.

Scetter.com

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/2.2.20/5.1.61-log/5.3.8/9.3.3.1


Guys, you're missing the point. I've said TWICE that the "original" queries were for testing. I've since fixed them which took all of 2 minutes to do. If there is something still wrong with the queries then please tell me what I'm doing wrong because they are working in my previous code snippet that I posted. If they aren't formatted correctly in order to work with the RSS format then please tell me why. Don't just say they are wrong. That doesn't help much. Thanks to kendle who posted how to optimize the query. That's been much more help than 2 devs here telling me I'm wrong wrong wrong.

The problem now is that the RSS feed isn't updating/populating my reader. Is the send_mail function responsible for how RSS updates? I think it's just the pubdate tag but I've put in a fake and correctly formatted static text version into one of the entries and it still doesn't update so I'm clueless why it's not working.

If you look at the link to the RSS I provided you'll see my queries do work and the data is in the php page. My reader just isn't parsing the data correctly.

As much as I appreciate it when people tell me what I'm doing wrong I appreciate it much more when people tell me how to do it right.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33/4.4/4.3.11


$result = $db->sql_query(''); if ($row = $db->sql_fetchrow($result)) { $date = date('D, d M Y H:i:s \G\M\T', DB_DATE); header("Date: $date"); } else { $date = date('D, d M Y H:i:s \G\M\T', gmtime()); } . . . . if ($row) { do { echo '<item> <title>'.htmlprepare(DB_TITLE).'</title> <link>'.getlink(DB_URL, true, true).'</link> <description>'.htmlprepare(DB_DESCRIPTION, false, ENT_QUOTES, true).'</description> <pubDate>'.date('D, d M Y H:i:s \G\M\T', DB_DATE)."</pubDate> </item>\n\n"; } while ($row = $db->sql_fetchrow($result)); }

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


ok, the reason it wasn't updating was because the rss format is extremely picky about the pubdate format. unless i recode the whole module to use the rss date i'm not sure i'll get it to update correctly. i think that's something in the future of the mTeam module. everything is updating in my rss feeder but it's using the php born date of 1969.

thanks nano that was helpful and you'll be proud to know i've taken out the security class include. it works without it now.

<?php /****************************************************** mTeam: CMSDreams.co.uk - Mark Roper Contributions by TreasureCoastDesigns.com - DJDevon3 ***************************************************** Revision: 1.2 Author: djdevon3 Date: 2007/07/17 ******************************************************/ define('XMLFEED', 1); $root_path = dirname(dirname(__FILE__)); if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $root_path = str_replace('\\', '/', $root_path); //Damn' windows } if (strlen($root_path) > 2) define('BASEDIR', $root_path.'/'); else define('BASEDIR', '../'); //require_once(BASEDIR.'includes/classes/security.php'); require_once(BASEDIR.'includes/cmsinit.inc'); require_once(BASEDIR.'includes/functions/language.php'); if (!is_active('Team')) { die('Team module not active'); } $sql = ' SELECT p.pid, p.joined, p.status, u.username, t.tid, t.tname, t.tdesc FROM '.$prefix.'_team_player AS p LEFT JOIN '.$user_prefix.'_users AS u ON (u.user_id=p.pid) LEFT JOIN '.$prefix.'_team_team AS t ON (t.tid=p.tid) WHERE p.tid=10 ORDER BY p.status, u.username '; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) { $date = date('D, d M Y H:i:s \G\M\T', $row['joined']); header("Date: $date"); } else { $date = date('D, d M Y H:i:s \G\M\T', gmtime()); } list($pid, $joined, $status, $username, $tid, $tname, $tdesc) = $db->sql_fetchrow($result); $BASEHREF = ereg_replace('//rss.', '//', $BASEHREF); header('Content-Type: text/xml'); // application/rss+xml echo '<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>=LG= '.$tname.' - '.$tdesc.'</title> <link>'.$BASEHREF.'</link> <description>'.htmlprepare($backend_title).'</description> <language>'.$backend_language.'</language> <pubDate>'.$date.'</pubDate> // <ttl>60</ttl> a number of minutes that indicates how long a channel can be cached before refresh. <ttl>'.(60*24).'</ttl> <generator>DragonflyCMS and mTeam</generator> <copyright>'.htmlprepare($sitename).'</copyright> <category>Team List</category> <docs>http://backend.userland.com/rss</docs> <image> <url>'.$BASEHREF.'images/'.$MAIN_CFG['global']['site_logo'].'</url> <title>'.htmlprepare($sitename).'</title> <link>'.$BASEHREF."</link> </image>\n\n"; if ($row) { do { echo '<item> <title>'.htmlprepare($row['username']).'</title> <link>'.getlink('Team&op=playerProfile&pid='.$row['pid'], true, true).'</link> <description>Member Since: '.htmlprepare($row['joined'], false, ENT_QUOTES, true).'</description> <pubDate>'.date('D, d M Y H:i:s \G\M\T', $row['joined'])."</pubDate> </item>\n\n"; } while ($row = $db->sql_fetchrow($result)); } ?> </channel> </rss>

Thanks to everyone that's helped with this. I think this is as far as I can go since the module doesn't use the correct pubdate format. Other than that it's up and running very well. I just wanted to lay the groundwork for Kendle so he can take this and make some nice RSS features for the mTeam module. This should be a good starting point for him. Thanks.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33/4.4/4.3.11


mTeam stores the date as a string of the form :-

YYYY-MM-DD HH:MM

No idea why I did that, I just wanted to do simple date sorting and formatting without using PHP time functions when I first started coding.

If you want to format pubdate properly you can convert the string to a timestamp and then to a properly formatted string like so:-

$date = $row['joined']; $date = mktime(substr($date,11,2),substr($date,14,2),0,substr($date,5,2),substr($date,8,2),substr($date,0,4)); $date = date('D, d M Y H:i:s \G\M\T', $date);

Alternatively strtotime() might work and would be more elegant:-

$date = date('D, d M Y H:i:s \G\M\T', strtotime($row['joined']));

Not sure if that will work tho, you'd need to test it.

Gaming League / Cup - www.leaguecms.co.uk :: Other DragonFly modules - www.cmsdreams.co.uk

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Couldn't get either to work and that's ok. It's serving my purpose which is to get a team list via rss going and to give the module a starting point for rss integration. It would be nice to get the pubdates correct but not entirely necessary because I'm not sorting by pubdate anyway. It's sorting by status (rank).

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.33/4.4/4.3.11

All times are UTC