DeeEmm

Pragmatism in code

Michael Percy AKA DeeEmm - Waxing lyrical about life the universe and everything software related since lunchtime 2006.
DeeEmm AKA Michael Percy is an industrial software engineer specialising in language based programming. A long time supporter and contributor to the open source community, he can mostly be found tinkering about creating web sites and writing code for various CMS platforms as well as maintaining several websites of his own.

Dolphin Tag Converter

If like me, you used the migration tool to transfer your Dolphin 6 based site over to Dolphin 7, you will notice that there are some things that need a little tweaking. One of these things for me was the tags.

On D6 tags could use a space as a delimiter, but on Dolphin 7 the space is ignored, this is to allow multi word tags. What this effectively does is create massive long 'tag words' out of those tags that were entered without using a comma as a delimiter in D6.

The following code reads the tags and splits them up if more than one word is detected. it then deletes the original entry and creates a new entry for each word detected using the original data. Single word tags are ignored

$sql_query = mysql_query("SELECT * FROM `sys_tags`");

...
Continue reading
2986 Hits
1 Comment

Boonex Dolphin Security Vulnerability

It seems like this week is a bit of a strange one so far. Not only is it National Cyber Security Awareness Week here in Australia, but first the Boonex site suffered a massive DDOS attack and then my own dolphin site suffered a similar fate. I believe that the two events are probably coincidental, as the attack on my site was not particularly well formed, and was easily defeated - most likely just some kiddie with a script. I managed to get the service that the attack was coming from terminated due to a violation of the providers TOS - they're probably in big trouble with mom and dad now. The attack on the Boonex site continued over the weekend, and there are still some services out of action.

I believe that the main source of the attack on my site was to take advantage of the exploit recently published on Boonex's site, and reported about here on DeeEmm.com in an earlier news article - http://www.deeemm.com/news/154-dolphin-7-security-vulnerability-exposed.html Whilst the noise about this issue seems to have been muted a little, after the attack on my site I am pretty convinced that the solution given by Boonex is no solution at all.

The main crux of the problem was claimed to be the DB_FULL_VISUAL_PROCESSING or DB_FULL_DEBUG_MODE settings, which caused the debug backtrace to be echoed directly to the browser in the event of a fault. Boonex's comments were simply that these were disabled by default and so the issue was a non-issue. This glaring oversight caused an obvious embarrassment to those who made the claims that the issue was with the DB_FULL_VISUAL_PROCESSING setting, this then caused them to promptly back off a little.

Whilst Boonex's solution has seemingly pacified the masses, it does not address the initial issue - that the debug back-trace is getting echoed to the browser in some error situations. The fact is that the issue has been reported by many, and until now no one had been sure of a definite cause, unfortunately the DB_FULL_VISUAL_PROCESSING setting was little more than a red herring, and whilst easily dismissed by Boonex, their solution does not actually fix the issue.

...
Continue reading
4262 Hits
0 Comments

Dolphin Forum - Show Expanded Categories

Here's a quick hack to get the forum categories to display as expanded by default on the forum home page.

Edit modules/boonex/forum/classes/Forum.php

Search for the following...

            if (( isset($p['cat']) && $p['cat'] == $r['cat_uri'] ) /*|| 1 == $r['cat_id'] */)
            {
                $this->setTitle ($r['cat_name']);
                $c .= ''.$this->getForumsXML ($r['cat_uri'], 0) . '';
            }

Comment the following lines

...
Continue reading
4434 Hits
0 Comments

Nowdoc string handler

Some of you may be familiar with the heredoc string handler which allows multi-line strings to be easily assigned to a variable, this great tool has many uses - such as retaining pre-formatted layout and improving the readability of code. The heredoc handler also parses variables contained within the string - much the same way that using double quotes does. Replacing any variables with their respective values

This has some not so obvious drawbacks, one of which i discovered whilst trying to inject complex PHP code into a database for later evaluation via the eval() statement. (please don't ask why)

The problem I found was that whilst it was easy to escape the string so that it would not break the SQL statement, The same escape characters also broke the evaluation. This might not have been an issue in any other situation, but for this particular project i did not have access to the code that carried out the evaluation so that I could strip the escape characters out before running the eval query.

However, PHP 5.3 has now introduced the nowdoc syntax - this basically operates in the same manner as heredoc, but does not parse any of the content. This means that not only are variables not parsed, but neither are any characters that would normally require escaping. In essence, any string read into a variable by the nowdoc handler will not require any escaping whatsoever.

...
Continue reading
2051 Hits
0 Comments

Dolphin 7.0.1 and beyond

The latest release to Boonex's CMS system - Dolphin 7, has now been out on the wild for some time. Released at Christmas, the much anticipated Dolphin 7 was to be heralded as the latest in web tech, offering an advanced platform for social networking sites that was far ahead of the competition. With several public beta releases, the anticipation was fueled by the glimpses offered in each release, building up the expectations to a massive level. Also adding fuel to this fire, was the long overdue update and bugfix release due for Dolphin 6. As a result, Dolphin 7 had a lot to deliver.

With the release of Dolphin 7 finally made a year later than expected, it was unleashed into the public with a massive amount of issues, over 300 bugs to be precise. This left the Dolphin community a little abashed, with many users having stuck with Dolphin, through the extended development period, now feeling disappointed. Lots of these users had put development plans on hold, with the expectation that the promised release would be the answer to their needs.

It is now a further 5 months down the line, and the recent update release 7.0.1 has addressed many of the problems that plagued version 7. The problems are not completely fixed however, and there are still many issues surrounding how development and releases are handled, but it seems that Boonex are moving in the right direction with a shorter release cycle, and prioritisation of bugs addressed for each release. I previously touched on this issue with one of my blog posts over at unity - http://www.boonex.com/unity/blog/entry/Product_release_cycles

Based on past performance at Boonex, and anticipating the issues and extended wait with version 7, when it was originally announced, I decided to stick with version 6  - This is a choice that i am glad i made. Not only as the expected release date slipped way beyond the original estimate, and there were more issues than even I anticipated, but also as it has meant that I have managed to build my user-base over the past year, and develop the community for which the site serves.

...
Continue reading
4528 Hits
0 Comments

D7 Hide Promo from logged in users

If you would like to hide the flash promo from displaying to logged in members all you have to do is the following.

Edit inc/design.inc.php

Find the following line in the getPromoCode() function (it's the last line)

return $sCode;

...
Continue reading
2439 Hits
2 Comments

D7 Move avatar from promo to banner

After updating my Dolphin 6 site to the new version 7 software I decided that I wanted to move the avatar to the banner - basically the same as for my D6 site. I also wanted to put the quotes at the bottom - I decided to mimick the style and layout for my D6 site - I wanted my upgrade to D7 to be more or less transparent to my users.

 

How To Relocate the daily quotes

To modify the quotes position is  simple enough - you just need to modify the sys_injections table - look for quotes_injection and then change the key to injection_footer_after

injection_footer_after refers to the tag that the content will replace - in this case the tag in the footer

...
Continue reading
2993 Hits
1 Comment

DMCMS beta builds

In a recent forum post about DMCMS, i promised that at some point the current version would be spruced up a little and released as version 1. This is something that I actually started on late last year, but the work was lost when our house was burgled and my laptop (and also the backup drive) was stolen. This happened last September, and it's taken this long to renew the enthusiasm in DMCMS. This is probably spurned in the most part, by the new direction that the site has recently taken, with more time being spent putting web based code mods together, I've began to start thinking about getting DMCMS finished off again.

With more visitors coming for code tutorials and to buy modifications from the store, DMCMS is a bit of a show-case - not in the respect that it is anything worth looking at (it's 6 years old now, and very basic by today's standards) but in the respect that it may be used as some kind of yard stick for my work. So it needs to be tidied to the point where it is at least presentable.

My ideal goal would be to take it and completely re-write it using the jquery framework, smarty template's and maybe a few other Web 2 goodies. Probably the most important aspect would be making it a multi-user version, to allow commenting and third party participation, and using object based code to allow for extensibility.

So with this in mind - I've taken the first steps to getting the current version up to a version 1 release standard. The main changes that I previously carried out were mostly a simple code restructure. The administration interface was completely split away from the main code so that it functioned as a stand alone interface - and some of the other functions that were crammed into the main code were also parred away.

...
Continue reading
3304 Hits
0 Comments

BoonexNerd Update

Just had a bit of a chat with James Tadeo, who has recently updated his successful Boonex support site BoonexNerd.net to run from the latest Dolphin version - 7.0.0. James blogged about the migration which he said went fairly smoothly using the migration tool that comes with D7, great news to hear for those of us who have still yet to update.

This got me thinking about the update to my own Dolphin site. I started to have a look at this a little while back - i set up a fresh D7 installation, which had a few issues as I had to reconfigure the server setup to suit D7. then I made a start with the data migration tool. I got as far as transferring the user-base over, but have been pretty busy since, and so have never progressed any further.This is something that I really need to make some time to go and sort out.

My main concern was that my D6 site is fairly modified, and whilst D7 does have greatly improved functionality, it does lack some of the mods that my members have come to expect. These mods are a mixture of purchased mods and mods that I have developed myself. There are also a large number of minor enhancements and bug-fixes that are hopefully now covered by the new D7 feature-set. the site has been developed over the past year, which is a nice and comfortable time frame to have developed a site this modded. Unfortunately with the upgrade, time is not that plentiful.

At present I think I will wait for the D 7.0.1. update to be released before revisiting the upgrade. I will have a look into rewriting the current mods for D7 and see how much work is involved, maybe I can temporarily drop a few of the mods to buy a bit of time.

...
Continue reading
1373 Hits
0 Comments

Dolphin 6 - Login Redirect MOD

This mod will automatically redirect new members to the profile edit page when logging in for the first time. Every time thereafter members are taken to their profile page

 

...
Continue reading
2373 Hits
0 Comments

Delete .DS_Store files

Whilst recently packaging some files for distribution, I noticed that that the folders that i was compressing contained .DS_Store files. These .DS_Store files are hidden files used by OSX to store metadata such as icon position and view settings. They are similar to the thumbs.db file used on windows, and are equally annoying when packaging files up for viewing on other systems.

By default the .DS_Store files are hidden in OSX, unfortunately this is not so for other systems where they are displayed alongside whatever content you packaged Not wanting to have to manually drill down through various folder levels to delete each and every instance, I decided to have a quick google to see what I could find.

First page up led me to Ryan Grier's site, where he has an application called the 'DS_Store Cleaner v1.5' listed. The app has not apparently been updated since January 2005, but this is not an issue, as the app works perfectly.

Basically after unzipping the app, place it somewhere on your mac (the application folder seems like a good spot) and then drag it to your dock to create an icon. Now simply drag the folder you want cleaned onto the DS_Store Cleaner icon. After chugging away for a little while, you will be notified by an alret box as to how many .DS_Store files have been deleted.

...
Continue reading
4714 Hits
0 Comments

PDF Generation - Add Custom text into footer

This is a quick and dirty hack to add some text to the footer of the PDF's generated within Joomla. The library used to generate the PDF's is the open source TCPDF library - http://www.tcpdf.org To add code into the footer of the generated PDF's, you will need to edit the following file:

/libraries/tcpdf/tcpdf.php

Find the following code in the footer() function

//Print page number
if ($this->rtl) {
$this->SetX($this->original_rMargin);
$this->Cell(0, $footer_height, $pagenumtxt, 'T', 0, 'L');
} else {
$this->SetX($this->original_lMargin);
$this->Cell(0, $footer_height, $pagenumtxt, 'T', 0, 'R');
}

...
Continue reading
9844 Hits
0 Comments

TinyMCE - add items to style drop down

If you have to display code snippets on your Joomla site, you might find that the following mod is of help. This quick mod will allow you to add items to the styles drop down in the TinyMCE editor - in this case a style for the code class.

The mod is pretty straight forward.

Normally when TinyMCE is called it looks for a stylesheet called 'editor.css' in the default templates CSS folder. The contents of this are used to propagate the styles drop down. If this file is not found in the default templates CSS folder, then the system version is used instead. To add custom styles to the drop down, simply create the following file. (where current_template is the name of your template)

/templates/current_template/css/editor.css

...
Continue reading
8365 Hits
0 Comments

Toggle Hidden Files In Finder

This is a great little tip for showing hidden files in OSX. Normally all files are hidden, and so access to the hidden unix filesystem is not possible. This is easily overcome however. You can either permanently disable this feature by running the following command in terminal.

defaults write com.apple.Finder AppleShowAllFiles YES

or, if you need to change the visibility on a regular basis the following may be of more help

Open up the apple script editor and paste in the following code

...
Continue reading
2611 Hits
0 Comments

DMCMS Lost and forgotten?

Development on DMCMS has laid dormant for a while, and to most it probably seems like it has been abandoned. Work commitments, managing websites, becoming a father, running my own business, renovating a house, building a car or two, plus various other projects take up lots of time, and I end up finding that I have none left to do things like develop DMCMS.

Last year I actually picked up from where I had left off and rewrote the current 0.7.6 version to release it as a branch of the main code - `DMCMS Light Version 1`. A lot of progress was also made on the Version 0.8.0 code, with many features production ready. Unfortunately we suffered a break in at our premises, and both the laptop the code was developed on, and the backup drive were stolen. Unfortunately, as a result of this, all of the development files were lost, as I had not committed any changes to CVS.

Having just updated the site, I just noticed that most of the work on the 0.7.6 release was uploaded here - the old site was running from it as it was one of my live test sites. So with a little work, I should be able to get back to the same status - a production ready version 1. At this stage I am not completely sure what status the code is at - there may have been other untested changes that were lost, but the main part of the re-write - a change in file structure - is very obviously still intact. When I get time, I will have an audit.

Unfortunately, the theft, and the loss of most of 0.8.0 has now made me have a bit of a rethink about what to do with it, and at present, I am not sure whether I will continue. There is simply too much ground to make up. If anything, a full rewrite might be both a quicker option, and one that brings DMCMS up to date. There are a lot of well thought out aspects of DMCMS, but there are many aspects that do not lend themselves well to managing a user-base, and extensibility - both things that were not considered way back in 2004 when I first started writing it.

...
Continue reading
2296 Hits
2 Comments

VMware Fusion - Increase virtual machine size

Like many ex M$ Windows users, I still have the occasional need to use it to run programs on that will not run under OSX. For example, probably all of the programs I use for PLC programming simply will not run natively on the Mac. This leaves me with two options - carry round another laptop (sometimes happens), or use a virtual machine.

A job I did recently for a client required I install some additional windows based software, to program the obscure controller that they had. At the time I just had my Mac on me, so I powered up Vmware and started to install the code. Unfortunately the installation started to hang about half way though - the issue was a nearly full disc.

I keep my virtual disc size fairly lean - the work I do is quite storage intensive, requiring lots of space, so I tend not to waste space if I can avoid it. It's easy enough to resize the disc if necessary. So that is what I did. Fortunately I am usually prepared for these things as you never know what will happen when you are stuck working in the middle of nowhere,

A friend of mine, just emailed me to ask how to change the disc size, so I thought I might as well add it up here

...
Continue reading
3954 Hits
0 Comments

Times a Changing

The site migration is pretty much finished, with just a few small odds and ends to fix up. One of the things that I have left to do is to add in some re-directions for the old content. When moving content it is always a good idea to redirect visitors to the new location with a 403 error response to the users browser. This will in turn be trawled by the web crawlers and your new location duly noted. As the old content locations followed the navigation structure of the old site code, I can add in one or two rules in my htaccess file using mod_rewrite and regex to redirect users from specific areas of the old site.

You may have noticed that the new site no longer runs from DMCMS, and whilst I do feel more than a little guilty about this, I simply did not have the time to integrate shopping carts, trouble ticket systems, forums and user handling into the DMCMS core. It was much quicker and easier to use existing products. Plus, the idea with DMCMS is that it is a simple and easy to use CMS, so integration of additional third party software does not fit with the idea behind it.

The online store is now up and running, although there is currently only one product (DMCMS) this is just for testing purposes. I will add in the premium mods as I develop them. All mods are instantly downloadable on checkout. There are one or two mods for Dolphin 7 already in the works, with more planned to come.Purchasers of premium mods also get access to the helpdesk system for dedicated support.

There are free mods available from the Resources > Tutorial section, this is basically the 'How To' section from the old site, that has now been categorized, I will add hints and tips here as I get time. There are a bunch of mods I developed for Dolphin 6 that I need to convert into proper mod format. My ultimate idea is to strike a balance between free mods and paid mods.

...
Continue reading
2235 Hits
0 Comments

Fixing the paragraph spacing issue

You may have noticed that after neatly setting out your post within the TinyMCE editor, when the page is published, the paragraphs are all squashed up.

The issue is a CSS issue. Basically the style applied to the P tag by TinyMCE and D7 are different - so it displays OK in the editor, but when the D7 code renders it - it is displayed differently.

The offending code is in templates/base/css/general.css, the attribute margin:0px is applied to the P tag, remove this and the issue will be gone, BUT there is one caveat - obviously this affects ALL instances of the P tag - so it may be that whilst this cures the immediate issue, it may cause problems elsewhere (i've not tested this, and this may be different for your site - depending on which template you use and what modifications you have applied to them)

To fix the issue, you will need to change general.css in two places -

...
Continue reading
3131 Hits
0 Comments

Dolphin 6 - Add / Move Advertising Banner To Block

If you would like to utilise the inbuilt banner manager in Dolphin, you are stuck with the locations lais out in the templates. Sure you can move the banners to another position within the template files, but what about if you wanted the advert to appear in it's own block? Well, here's how...

To add the banners to a block you will need to add a PHP block - to to this simply drag one into the desired position in the page builder in the admin panel. I've added one to the left column on the homepage. Rename it with something meaningfull - i named mine 'advertisement' :D

Now here's the tricky part... You will need to directly edit the database to be able to add your PHP code. I personally use phpMyAdmin, but there are many other database editors out there.

So fire up your favourite database tool and go to the 'PageCompose' table and search / browse for your newly added block.

Now add the following PHP code to the 'Content' field

echo banner_put_nv(2);

(the number 2 relates to the left block - 1, 3 and 4 relate to the top, right and bottom blocks repsectively)

If you are using the borderless block mod - you will also need to wrap this in a div and give it a height as it will overlap the content below it.

Now, once you've entered this- go back to the admin panel and move your newly created block to another position - and then move it back to the desired position. This clears the cache - if you don't do this - your new block will not display. Now navigate to your homepage and check out your new banner ads in a block.

...
Continue reading
3530 Hits
0 Comments

DOLPHIN - Create Custom Blocks

Just a very quick tutorial this time.

i was looking for a way to create a block that didn't have the normal border and header so that I could add in my own custom HTML. After looking through the code, this is very easy to do - in fact it doesn;t even really need a modification (well not in the traditional sense of the word).

Basically what you need to do is this...

  1. Go to the Page Builder in the admin interface
  2. Create a block by dragging the 'Simple HTML' sample into position.
  3. Add your HTML / text etc, give it a meaningful caption and save it
  4. Now you will need to get access to your database by using something like phpMyAdmin.
  5. Go to the 'Page Compose' table and find the entry for your newly added block - TIP look for the same caption
  6. Now edit this record so that the value of 'Design Box' is 0
  7. Now you can checkout your new border-less block by viewing your site in a browser.

DM

3523 Hits
0 Comments