Archive for August, 2009

JOOMSUITE: how to add SEF to file downloads

Sunday, August 23rd, 2009

I finally managed to finish my SEF-related hacks on joomsuite for joomla in order to add SEF url support to the filw downloads.
You need to edit 3 files and add url rewrite rules.
/components/com_resource/controller.php:335 (download function)

$fn = basename($res->field_value);
if (JRequest::getInt('timestamp')==1){
  $a = explode('_', $fn, 2);
  $fn = $a[1];
}
if($browser=='IE') {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header('Pragma: public');
} else {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: no-cache, must-revalidate');
  header('Pragma: no-cache');
}

./components/com_resource/controller.php:450 (download2 function, after adding above code)

$fn = basename($res->field_value);
if (JRequest::getInt('timestamp')==1){
  $a = explode('_', $fn, 2);
  $fn = $a[1];
}
if($browser=='IE') {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header('Pragma: public');
} else {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: no-cache, must-revalidate');
  header('Pragma: no-cache');
}

./components/com_resource/controllers/article.php:778 (download_attachment function)

$fn = basename($comment->attachmente);
if (JRequest::getInt('timestamp')){
  $a = explode('_', $fn, 2);
  $fn = $a[1];
}
if($browser=='IE') {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  header('Pragma: public');
} else {
  header('Content-Disposition: attachment; filename="'.$fn.'"');
  header('Cache-Control: no-cache, must-revalidate');
  header('Pragma: no-cache');
}

./plugins/joomsuite_content_fields/file.php:179 (onRenderFieldValue function)

if($params->get('show_name'))
{
  // Ciuly - make it SEF
  if (JROUTER_MODE_SEF)
    $download = JURI::base()."download.php/$field->id/";

  $label = basename($field->field_value);
  // Ciuly - remove timestamp from display
  if ($params->get('attach')){
    $a = explode('_', $label, 2);
    $label = $a[1];
    if (JROUTER_MODE_SEF)
      $download = $download . "1/";
    else
      $download = $download . "×tamp=1";
  } else
    if (JROUTER_MODE_SEF)
      $download = $download . "0/";
  if (JROUTER_MODE_SEF)
    $download = $download . $label;
}
else {
  $label = $field->title;
}

and finally, url rewrite:

    RewriteEngine on
    RewriteRule ^/download.php/([0-9]+)/([0-1])/.*$ /index2.php?option=com_resource&task=download&no_html=1&file=$1×tamp=$2

Related posts

Nice filenames on new site

Saturday, August 22nd, 2009

As always, I started hacking into the joomsuite recources components and field plugins. I made it so it no longer displays nor sends the file with the preceding timestamp in it.
Now it is looking nice.
Next step will probably be to make it seofriendly url, not for the SEO part but for my greasemonkey section where in order to install the scripts in firefox and IE they need to have the filename in the url as last element and as a file not parameter.
So, more hacking to be done in the following days.

Related posts

An existing directory does not exist…

Wednesday, August 19th, 2009

I am working on making indy 10 tiburon compile under lazarus/fpc and right now I’m trying to get a modified package file to compile the needed stuff as apparently cannot do it (probably lack of time as with everyone)
I got the system stuff compiled but then while trying to compile the core, I got an error that IDException unit cannot be found. So I rushed to the package dirs and add the path to the system stuff. And then I got the following, stupid, error:

existing dir not found

existing dir not found


Now, as you can see this error practically says that, and now I’m playing the compiler:
“I know I am compiling the core, which is in the directory I’m looking for, but I just cannot see the directory I’m working from”.
Is there a medic in the house?

Later edit: the following picture is a bit more suggestive. It shows the loaded package path and the error, thus clearly marking that the idiot lazarus cannot find a path that is actually the one in which is located the package it tries to compile.

Existing dir not found 2

Existing dir not found 2

Related posts

Site relaunch/redesign. Stage 1

Wednesday, August 19th, 2009

I have almost completed the re-design/launch/write of the site, stage 1. That means the Delphi section.
It’s written in joomla 1.5 and I still need to get the ads to show up properly.
I spent a lot of time trying to get the hit counts, but for some files I only had 1 year worth of usable logs so … some stuff will remain with hit count 0.
Everything in delphi section SHOULD be 301-ed to the new locations.

Enjoy and let me know of issues/improvements.

Related posts

API module structure `php5_module’ in file modules/libphp5.so is garbled – perhaps this is not an Apache module DSO?

Monday, August 17th, 2009

While trying ot install php 5 in apache 2.2 I was getting the following error on apache startup: API module structure `php5_module’ in file modules/libphp5.so is garbled – perhaps this is not an Apache module DSO?
although both apache and php work fine run separatelly.
After a lot of debugging and reading I figured I’d do the php thing all over again and then noticed:

libtool: install: warning: remember to run `libtool –finish /kits/php-5.2.9/libs’

AND

You may want to add: /usr/local/lib/php to your php.ini include_path

minor details but they DID NOT help. But I am taking the time to rant a bit: why for the love of god won’t teh installer do the libtool call when it finishes? beats me.

Anyway, the problem is because there is an old version of apache on the system. Get rid of it first. ALL of it. rm -rf does a good job. But don’t delete your sites.
So, if unsure, backup frist.

Related posts

php5 ./configure error: Cannot find MySQL header files

Sunday, August 16th, 2009

I was installing php and the rest on ns3 and obviously I got the latest php 5.2.9
Using the usual configure options I was getting: configure error: Cannot find MySQL header files
Turned out I had to pass the base mysql installation folder to both the –with-mysql option AND –with-mysql-pdo=shared which rutned into “–with-mysql-pdo=shared,/path/to/mysql” without the quotes. or with them, doesn’t matter for the shell.

Related posts

Twitter down

Saturday, August 15th, 2009

I posted a coiple of blogposts and expected the autotwitter to do its job and since I lunched the alus.ws shortener service and made it use that one instead of tinyurl I figured I shoudl check to see if it posts ok. To my dissapointment, it did not.
So, I wasted about 1 hour going through logs and making tests and all just to see it’s not working. Then, I googled and found out that actually there is (was) some kind of attaack which rendered the twitter site and some others useless.

God I hate hackers.

Related posts

New site on the net: all about me

Saturday, August 15th, 2009

I finally managed to launch the long-awaited (by me at least) site about me. ALL about ME.
I’m so ego-centric and ego-everything.
Since it just launched, there is not much on it 🙂
So read more about me here: http://www.ciuly.info/

Related posts

Tertiary DNS Server is now online

Saturday, August 15th, 2009

I finally managed to pull this off. I set up ns1.ciuly.com, ns2.ciuly.com a while ago and now ns3.ciuly.com and migrated 2 of the websites to use them.
I will be monitoring how things work and if all ok, I’ll probably migrate all my websites on them.
The reason for this is that I plan on supporting dynamic sub-domains on at least the new alus.ws url shortener website I launched yesterday.

Related posts

My very own URL shortener service

Saturday, August 15th, 2009

I just started up my own url shortener service on ALUS based on tinyurl wo which I made 2 modifications at this time:
– presented the user the very short url, without the i parameter (as in http://alus.ws/1(3 characters shorter than default)
– added another parameter, tinyurl, to the save GET request which simulates the same output as the tinyurl.com api-create.php page. This part is then used by the autotwitter I use, which i also had to modify because it uses tinyurl hardcoded

Enjoy 🙂

Related posts