One of the primary internal functional changes to Rollator, besides becoming a CMS unto it’s own right – from it’s old blog days, is to tout full administrative functionality; with not only a localized ‘root’, or ‘Administration’ user, but to offer subusers various access to editing and modifications, et al.

After re-implementing my cookie logic to use PHP sessions instead, I figured I might do a bit of cleanup of the backend interface; it’s quite usable, as you can see in this elder version, but lacks a bit of refining polish.

One of the simple changes rolled into my existing system uses quite a bit of my initally-planned functionale. This is the ability to understand idling users; or people who login and neglect to post, or logout of the interface for a specific amount of time. Heck, we’ve all done it.

After implementing my idlecheck system, I figured it’d be much more logical and easier on the mind to give the user feedback as to various aspects of this. One of these features is my Administrative Toolbar, present atop of every internal functionale; it provides information as to what has occured, based upon what the user has entered.

One of these is, ta-da the display of this idle time. It’s quite trivial, and fairly unnecessary, as Rollator will, in plain english, tell the user if it logs them out, and why.

This data is stored as a numeric, which is the offset since the last point of activity, and the current time. I store this as a number of seconds, both for the ‘idle since’ numeric, and the ‘overall time’. Getting deeper into this logic is beyond the scope of this article.

However, I created a simple function I call prettytime() which will take an argument as a number of seconds, and convert it to a number of minutes and seconds, outputting this as a rather legable, human friendly string.

It’s a bit tight, and not horribly commented, but quite easy to get the gist of:

function prettytime($time) { // Returns an arbitrary pretty date of minutes and seconds, // assumes strings are in seconds. if (is_numeric($time)) { // Let’s get this messy math out of the way $minutes = floor(round(($time / 60) , 2)); $seconds = $time – ($minutes * 60); $string = ($minutes != “0”) ? ”$minutes minute” : “”; $string .= ($minutes > “1”) ? “s” : “”; if ($minutes != “0” && $seconds != “0”) $string .= ”, ”; $string .= ($seconds != “0”) ? ”$seconds second” : “”; $string .= ($seconds > “1”) ? “s” : “”; return $string; } }

It’s pretty simple in nature, and there’s just a few things I’ve done to make it nicer. If either of these (second, minute) are above 1, it will append an ’s’, so you will get data such as 2 minutes, 1 second, and 14 seconds, respectively.

Hope it helps you out.

I’ve opted to clean up the front page as well as other things locally. Some of these things I have decided should be deprecated, for instance, the front page has been becoming rather busy and overfull – there is no reason for a display of the last 5 songs I’ve listened to, and with my enhanced calendar in the upper left corner, there is no longer any feasable reason for my elder styled archive search being displayed in monthly increments.

I’ve kicked the music down to the last song, because I happen to like an archive of what I’ve been listening to since the creation of the applet, so I’ll continue to store and display it, albiet a bit less ostentatiously.

My “Latest Entries” has been quelched to five entries, and I’ve taken into consideration doing a ‘hard wrap’ of the ‘QuickURLs’ blogging functionality I introduced late last year.

The file manager has been retooled, cutting code by nearly a third since it’s implementation – it is at an interm state, but is quite fast, and will be faster with my next set of modifications I have set to roll out.

It’s nice to shed a bit of weight, after all.

Shawn’s Blue Cheez Burger

· 4 pounds ground sirloin · salt and freshly ground pepper · 16 oz crumbled blue cheese · 4 tbsp Worcestershire sauce · 4 Scallions, finely chopped · 4 tbsp olive oil · a few sprigs of Cilantro · 8 hamburger buns

Preheat the grill. Make it nice and hot. Divide the meat into sixteen portions, forming each portion into a round patty. With a large wooden spoon, mix the Worcestershire and blue cheese until nice and gooey. Peal the cilantro leaves from the stem. Discard the stems. Fold in the cilantro leaves and scallions. Place a quarter of the blue cheese mixture between two patties and squeeze the edges firmly together to seal the burger. Dip in the oil. Arrange the burgers, oil side down, on the hot grate and grill until nicely browned, usually 3-4 minutes. Brush the other side lightly with olive oil and season with the salt and pepper. Turn with a spatula and continue grilling till cooked to taste. Place on buns, serve. I suggest a nice soft drink that is light in sugar, and a side of browned fries.

Enjoy your meal!

Still in it’s infancy, my RSS Feed Reader has grown from a buggy concept into a fully-realized utility. Previously modeled upon Keith Devens XML-RPC, it’s been rewritten with a customized version of Onyx RSS.

Rarely is it required to “throw the baby out with the bathwater”, but my former implementation has been rewritten from a 200k+ monolith to roughly 40k.

It will read, parse, cache, then spew out a brief synopsis of articles available. I will be expanding it as I usurp it into my Rollator CMS system; but feel free to test it out. I will reimplement “Titles Only”, as well as other various tweaks in the near future.

Update: Heck, I don’t really care about Onyx; it’s a bit bloated for my needs. I’ve got all I need right here:

function startElement($parser, $tagName, $attrs) { global $insideitem, $tag; if ($insideitem) { $tag = $tagName; } elseif (($tagName "ITEM") || ($tagName “IMAGE”)) { $insideitem = true; } } function endElement($parser, $tagName) { global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n; if ($i >= $n) { return; } if ($tagName == “ITEM”) { printf(“� %s – %s
\n”, trim($link), htmlspecialchars(trim($title)), htmlspecialchars(trim($description))); $title = “”; $description = “”; $link = “”; $iurl = “”; $insideitem = false; $i += 1; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link, $iurl; if ($insideitem) { switch ($tag) { case “TITLE”: $title .= $data; break; case “DESCRIPTION”: $description .= $data; break; case “LINK”: $link .= $data; break; case “URL”: $iurl .= $data; break; } } } function parse_feed ($url, $num) { global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n; $insideitem = false; $tag = “”; $title = “”; $description = “”; $link = “”; $iurl = “”; $i = 0; $n = $num; // Create an XML parser $xml_parser = xml_parser_create(); // Set the functions to handle opening and closing tags xml_set_element_handler($xml_parser, “startElement”, “endElement”); // Set the function to handle blocks of character data xml_set_character_data_handler($xml_parser, “characterData”); // Open the XML file for reading $fp = fopen($url, “r”) or die(“Error reading RSS data.”); // Read the XML file 4KB at a time while ($data = fread($fp, 4096)) { // Parse each 4KB chunk with the XML parser created above xml_parse($xml_parser, $data, feof($fp)) // Handle errors in parsing or die(sprintf(“XML error: %s at line %d”, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } // Close the XML file fclose($fp); // Free up memory used by the XML parser xml_parser_free($xml_parser); $i = 0; }

As a followup to my initial search engine array post, I’ve implemented a rather useless little utility, slightly building upon it.

For one of my test sites, rather than having a generic ‘nothing here’ page, I decided to redirect the user to search for a given string based upon their forage into my directory:

header(“location: ” . randomSearchString($_SERVER[“REDIRECT_URL”]));

function randomSearchString($findString) { $randNum = mt_rand(1, 8); $searchengine = array ( ‘1’ => ‘http://www.altavista.com/cgi-bin/query?pg=q&what=web&fmt=&q=’, ‘2’ => ‘http://www.everything2.com/index.pl?node=’, ‘3’ => ‘http://msxml.excite.com/info.xcite/search/web/’, ‘4’ => ‘http://www.google.com/search?q=’, ‘5’ => ‘http://hotbot.lycos.com/?SW=web&SM=MC&DC=10&DE=2&RG=NA&_v=2&MT=’, ‘6’ => ‘http://search.lycos.com/?npl=&query=’, ‘7’ => ‘http://dpxml.webcrawler.com/info.wbcrwl/search/web/’, ‘8’ => ‘http://search.yahoo.com/bin/search?p=’ ); return $searchengine[$randNum] . $findString;
}
?>

What this does is take the string returned by the webserver and run it through my simple subroutine, which has a choice of 8 different search engines. It pseudo-randomly chooses one, appending this to the search, then blind-forwards the user to that search engine with a properly formatted query to search for what was given (in this case, my directory), in hopes that they find whatever they think they are looking for. Simple, and kind of cute.