News:

Happy New Year! Yes, the current one, not a previous one; this is a new post, we swear!

Main Menu

Digital Text CMS

Started by Warrior, December 04, 2005, 05:03:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Warrior

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Quik

I might be needing a final (or latest) version for a personal project, we can work that out when the time comes.
Quote[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

Warrior

Well I need to redo some thinking which I've since done on modules. I can get it done it's just that it's time consuming how I designed it. I need to make a lot of things easier. I also forgot a lot of what I was thinking while writing code so I'll need to reread some code.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Quik

Quote from: Warriorx86] link=topic=4009.msg72320#msg72320 date=1149504021]
Well I need to redo some thinking which I've since done on modules. I can get it done it's just that it's time consuming how I designed it. I need to make a lot of things easier. I also forgot a lot of what I was thinking while writing code so I'll need to reread some code.

Ok. There's not a HUGE rush, but I would like to get it done and up inside a month or two, if possible. Thanks.
Quote[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

Warrior

As part of my revision of DigitalText CMS I've decided to recreate my module system.


function HandlePluginPage()
{
if (!isset($_GET['plugin']))
return -1;
else
$plugin = $_GET['plugin'];


$query = $this->DB->PerformQuery("SELECT ID FROM Plugins WHERE Name='" . $plugin . "' LIMIT 1");

if ($this->DB->CountResults($query) == 0)
{
if (!is_file(SCRIPT_ROOT . '/plugins/' . $plugin . '.plugin.php'))
return -1;

$query = $this->DB->PerformQuery("INSERT INTO Plugins SET Name='" . $plugin . "'");

if (!$query)
return -1;
}

include_once SCRIPT_ROOT. '/plugins/' . $plugin . '.plugin.php';

if (!function_exists($plugin . '_main'))
return -1;

if (function_num_args($plugin . '_main')) != 2)
return -1;

$function = $plugin . '_main';

$arg = $_GET;

$ret = $function($arg, &$this);

if ($ret != 0)
echo "Unexpected behavior.";
else
echo "Plugin terminated successfully.";
}


It's untested and pretty preliminary and unoptimized but I think it should work.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

rabbit

The way you do your queries bugs me, still.

Also, you really need to make an error handler or something so that you don't have to check every result for an error.  I do like the passing of the parent object, though, I never thought of that.  And lastly, passing $arg = $_GET is redundant.  Personally, I'd assign the plugin's $arg values inside the _main function instead of passing a clone.

Warrior

Well I was thinking of passing only paramaters I wanted it to handle by the $arg param but I threw that in there to get it working quickly.

I'd really rather check each variable because I don't think writing an error handler would apply there? I do however have a general purpose handler written which reports errors to the DB but don't raise a message unless it's either fatal or verbose is on in the settings.

I'm not going to pass the entire core in the end, I'll write a layer ontop of the core which allows / disallows access to certain functions.

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

zorm

Interesting stuff but I still really don't get the point of the database calls...?
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Warrior

Stores information regarding the module and was meant to be extended further into something I've since forgotten.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling