RalphThesen - Code Snippets


Suggestion fpr FilesAction


FilesAction with the correct MIME Header (based upon mimes.txt)

Replace line 16:
            Header("Content-Type: application/x-download");

with the following lines :
        // Examine Suffix
          if (preg_match("/.*\.(\w+)$/i",$filename,$res))
            $suffix=$res[1];
          // Search MIME Type
            if (!$suffix || $suffix=="" || !$this->config['mime_types']
               || !$mimes=implode("\n",file($this->config['mime_types'])))
               $content_type="application/x-download";
            else {
               if (preg_match("/([A-Za-z\/-]*).*$suffix/i",$mimes,$result))
                  $content_type=$result[1];
               else
                  $content_type="application/x-download";
            }
          Header("Content-Type: ".$content_type);


Suggestion for ImageAction


A feature for the ImageAction would be, if you can use (via FilesAction) uploaded Images. To implement this add the following line after line 26 in action/image.php

// Enable upload='uploadedimage.extension'
if ($param == 'upload' and $vars['url'] == '')
$vars['url']=$this->GetConfigValue('upload_path').'/'.$this->GetPageTag().'/'.$value;


Example
{{image class="center" alt="Uploaded Image" title="The Image Title" upload="imagename.extension"}}

http://redimp.de/ImageActionUpload

To use this, you need a different htacces file.

Suggestion for a new htaccess File


This htaccess file allows the Browser to fetch existing files below the wikka root, even if rewrite is enabled. If you want to place subfolders below your wikka root with other projects/files/whatever, you can use this .htaccess too. For more Details see HtaccessConfig.

### STOP REFERRER SPAM
SetEnvIfNoCase Referer ".*(adultsite|picturesplace|learnthebiz|pi-o|erotica|ghettoinc|port5|bulk-email|camgirls|paris-hilton|modelos|kredit|handyflirt24|versicherung|wwww|erotower|krank|x-1000|flirtnet|blowjob|agedwife|in-the-vip|boysfirsttime|milf|captain-stabbin|tranny|Kontakt|erotik|fetish|frauen|hardcore|fick|krankenversicherung|jinnan-cross|8thstreet|xxx|XXX|ficken|fuck).*" BadReferrer

order deny,allow
deny from env=BadReferrer

## Enhanced Rewrite
<IfModule mod_rewrite.c>
 RewriteEngine on
## If the target is a directory and the trailing Slash is missing, append a Slash 
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^(.*/[^\./]*[^/])$ $1/ [L]
## If the file doesn't exist, forward to wikka.php 
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
</IfModule>




CategoryUsers
There are 5 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki