...somewhat damaged.

CakePHP 1.3.3 Broken Pagination Sort Options

CakePHP 1.3.3 Broken Pagination Sort Options

Working with CakePHP v1.3.3 and the Pagination helper I discovered that the Direction option for the Sort method sort of goes ignored— or more like over-written with whatever value CakePHP decides to use.   I’m not happy with my hack, but I need this functionality today.  I’m also not too fond of having to hack-up source code when upgrades will be involved because I have to keep porting forward my patches.  So anyhow.  Here’s what I’m trying to do.

In my view, I’d like to have sort options such as, Most Recent, Most Viewed, Longest Video, Shortest Video.  I’ve tried hard-coding the URL for the Paginator to use, this didn’t work well with some of the search options.  I tried to be crafty with $this->here, $this->action and $this->name.   I figured it’d be best to let the Paginator deal with it.  So I dug up the documentation on $this->Paginator->sort();  Set ‘direction’=>’desc’, and the generated link wasn’t in Descending order. :-S   Here’s what I found.

$dir = isset($options['direction']) ? $options['direction'] : 'asc';
unset($options['direction']);

$sortKey = $this->sortKey($options['model']);
$defaultModel = $this->defaultModel();
$isSorted = (
	$sortKey === $key ||
	$sortKey === $defaultModel . '.' . $key ||
	$key === $defaultModel . '.' . $sortKey
);
if ($isSorted) {....}

I changed it to check for the Direction option.

$dir = isset($options['direction']) ? $options['direction'] : 'asc';
//unset($options['direction']);

$isSorted = false;
if (!isset($options['direction']))
{
	$sortKey = $this->sortKey($options['model']);
	$defaultModel = $this->defaultModel();
	$isSorted = (
		$sortKey === $key ||
		$sortKey === $defaultModel . '.' . $key ||
		$key === $defaultModel . '.' . $sortKey
	);
}

if ($isSorted) {....}

Seems to work with all my other pagination throughout the site. I haven’t tested it heavily, but it appears to work.

Read More

Using CakePHP with Plesk 10

Using CakePHP with Plesk 10

If you haven’t already figured it out, you can’t just unarchive CakePHP and drop it into your httpdocs folder under Plesk. There’s some minor changes you need to make before Plesk plays nicely with CakePHP.

First think that needs to be done is to create a vhost.conf file in /var/www/vhosts/domain.com/conf/ directory that contains the following

 

<Directory /var/www/vhosts/domain.com>
	php_admin_flag engine on
	php_admin_value open_basedir none
</Directory>

After you’ve done that, you’ll need to run the Plesk command line tool to regenerate the vhost files.

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com
Read More

Vimeo, OAuth and CakePHP Session Security Settings

Vimeo, OAuth and CakePHP Session Security Settings

So after ripping my hair out for a good 2-3hrs trying to figure out why my Vimeo OAuth requests wasn’t returning any sessions variables, I finally figured it out.

CakePHP’s Configure::write(‘Security.level’, ‘medium’); sets PHP’s session.referer_check and denies any other hosts from setting session variables. I was wondering why half my sessions vars were gone and it would appear I was logged-out. Setting Configure::write(‘Security.level’, ‘low’); seems to have fixed the issue. But anytime you read ‘Security Low’ in the same sentence, it leaves you with some sort of uncomfortable feeling.

I’m not exactly sure what the status of this is. But I found a link that pretty much explains it all. session.referer_check PHP ini var should be decoupled from ‘High’ and ‘Medium’ Session Security levels

Read More

iCE Breaker’s Noisy Android!

iCE Breaker’s Noisy Android!

Here’s a ringtone / notification pack for your Android phone (and others, I’m sure). They’re ‘android-like’ female voice-prompts you can use for notifications. You can also use some of these with Tasker for certain Android related states/events.

iCE Breaker’s “Noisy Android”

Read More

Boxee + Boxee Box = BleedingMedia Video App!

Boxee + Boxee Box = BleedingMedia Video App!

I’ve only had my Boxee Box for a week or so and I’m already interested in how to make apps and see whatever else this thing can do. I have a good friend who runs a video site based around the UFC and MMA. We’ve always sort of tinkered with different support apps and ideas on how to promote each others pet-projects. I figured, HEY! Boxee App would be perfect! So I got to work. Using the PC version of Boxee as my development platform, I started investigating how to make this thing ‘Go’! It’s unfortunate the PC version is a few versions behind the times, but it seems all the same. After some tinkering, I have a beta version of the BleedingMedia.com Boxee App!!

BleedingMedia.com Boxee App

Read More