11
m0nty
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/10/31 22:34

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


hmmm

ok i know what wf-channel is etc.. but i've never used it or even installed it before, so bare with me.

do you have a link where I can see it working? and show me where you want the flash banner inserting? (link to us?)

getting wf-channel to be able to upload a .swf file shouldn't be difficult, it's probably the easy part.

the most awkward part will be modifying the code to actually be able to display the .swf file. as with a normal image file, it's just a plain old <img src=""> tag, but with .swf you need to embed the player source code into the page. in that case, you need some way of determining if the file is a reg image (.jpg, .gif or .png) or whether it's .swf, once that's determined you can tell the template to either place the image in a normal <img src=""> tag or whether it needs to be placed in the flash source.

12
LucaNet
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/10/31 22:47

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


Hi m0nty,

unfortunately my web site is still under construction, but you should be able to see WF-Channel working here.

I would like to insert swf banner in place of XOOPS banner example.

I'm sorry for my bad english, I hope you understand what I mean.

Here, the relative html code:

<{if $linktous.banner }>
    <
p><div align"left" class = "itemHead"><b><{$lang_displaybanner}></b></div></p>
    <
p><div align"left"><b><{$lang_bannerexample}></b></div>
    <
div><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' name='image' id='image' alt='<{$linktous.sitename}>' /></div></p>
    <
div align"left"><{$lang_displayscript}></div>
    <
textarea name='lienbt' cols='70' rows='4' wrap='VIRTUAL'><a href='<{$xoops_url}>' target='_blank'><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' alt='<{$linktous.sitename}>'></a></textarea>
<{/if}>

13
m0nty
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/10/31 23:16

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


you mean this banner?

Resized Image

14
LucaNet
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/10/31 23:23

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


I mean this:

Resized Image

15
m0nty
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/1 3:59

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


ok, it's not as simple as 1 would think.. but i have managed to get it to upload and display swf images.

there are some issues with it tho, once you have uploaded the swf file, you can then select the file in the select list on the form.. but the image will not display in the admin page.. although if you have selected the correct file from the drop down list, then it will show on the link to us page..

i haven't quite figured out yet how to make 'onchange='showImgSelected()' show an swf file yet.

other than the above issue, it works ok..

there's a BUT tho..

because wf-channel uses XOOPS core class uploader & xoopslists.php then you need to edit 2 of the XOOPS core files.. 1 edit is to remove the @getimagesize check for .swf extensions, otherwise an error: 'Suspicious image upload refused' is displayed. the other edit is to allow function getImgListAsArray() to list .swf extensions in the dropdown box.

now to the edits >

open xoops_root/class/uploader.php

find:

$ext strtolowersubstrstrrchr$this->savedDestination '.' ) , ) ) ;
        if( 
in_array$ext $this->imageExtensions ) ) {
            
$info = @getimagesize$this->savedDestination ) ;
            if( 
$info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
                
$this->setErrors'Suspicious image upload refused' );
                @
unlink$this->savedDestination );
                return 
false;
            }
        }
        @
chmod($this->savedDestination$chmod);
        return 
true;


replace with

$ext strtolowersubstrstrrchr$this->savedDestination '.' ) , ) ) ;
        if(
$ext !== "swf") {
            if( 
in_array$ext $this->imageExtensions ) ) {
                
$info = @getimagesize$this->savedDestination ) ;
                if( 
$info === false || $this->imageExtensions[ (int)$info[2] ] != $ext ) {
                    
$this->setErrors'Suspicious image upload refused' );
                    @
unlink$this->savedDestination );
                    return 
false;
                }
            }
        }
        @
chmod($this->savedDestination$chmod);
        return 
true;


save & close

open xoops_root/class/xoopslists.php

find

function getImgListAsArray($dirname$prefix="")
        {
            
$filelist = array();
            if (
$handle opendir($dirname)) {
                while (
false !== ($file readdir($handle))) {
                    if ( 
preg_match("/(.gif|.jpg|.png)$/i"$file) ) {
                        
$file $prefix.$file;
                        
$filelist[$file] = $file;
                    }
                }
                
closedir($handle);
                
asort($filelist);
                
reset($filelist);
            }
            return 
$filelist;
        }


replace with

function getImgListAsArray($dirname$prefix="")
        {
            
$filelist = array();
            if (
$handle opendir($dirname)) {
                while (
false !== ($file readdir($handle))) {
                    if ( 
preg_match("/(.gif|.jpg|.png|.swf)$/i"$file) ) {
                        
$file $prefix.$file;
                        
$filelist[$file] = $file;
                    }
                }
                
closedir($handle);
                
asort($filelist);
                
reset($filelist);
            }
            return 
$filelist;
        }


save & close.

open wfchannel/index.php

find:

$linktous['banner'] = ($banner == "blank.png" || !$banner) ? '' $myts->htmlSpecialChars($banner);


replace with

$ext ltrim(strrchr($banner'.'), '.');
    if (
$ext != 'swf')
    {
        
$linktous['is_swf'] = 0;
        
$linktous['banner'] = ($banner == "blank.png" || !$banner) ? '' $myts->htmlSpecialChars($banner);
    }
    else
    {
        
$linktous['is_swf'] = 1;
        
$linktous['banner'] = $myts->htmlSpecialChars($banner);
    }


save & close

open wfchannel/admin/upload.php

find:

$allowed_mimetypes = array('image/gif''image/jpeg''image/pjpeg''image/x-png');


replace with

$allowed_mimetypes = array('image/gif''image/jpeg''image/pjpeg''image/x-png''application/x-shockwave-flash');


save & close

open wfchannel/templates/wfchannel_linktous.html

find:

<{if $linktous.banner }>
    <
p><div align"left" class = "itemHead"><b><{$lang_displaybanner}></b></div></p>
    <
p><div align"left"><b><{$lang_bannerexample}></b></div>
    <
div><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' name='image' id='image' alt='<{$linktous.sitename}>' /></div></p>
    <
div align"left"><{$lang_displayscript}></div>
    <
textarea name='lienbt' cols='70' rows='4' wrap='VIRTUAL'><a href='<{$xoops_url}>' target='_blank'><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' alt='<{$linktous.sitename}>'></a></textarea>
<{/if}>


replace with

<{if $linktous.banner && $linktous.is_swf == 0}>
    <
p><div align"left" class = "itemHead"><b><{$lang_displaybanner}></b></div></p>
    <
p><div align"left"><b><{$lang_bannerexample}></b></div>
    <
div><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' name='image' id='image' alt='<{$linktous.sitename}>' /></div></p>
    <
div align"left"><{$lang_displayscript}></div>
    <
textarea name='lienbt' cols='70' rows='4' wrap='VIRTUAL'><a href='<{$xoops_url}>' target='_blank'><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' alt='<{$linktous.sitename}>'></a></textarea>
<{elseif 
$linktous.banner && $linktous.is_swf == 1}>
    <
p><div align"left" class = "itemHead"><b><{$lang_displaybanner}></b></div></p>
    <
p><div align"left"><b><{$lang_bannerexample}></b></div>
    <
div>
        <
object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id=index width="468" height="60" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0">
        <
param name="movie" value="<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>" />
        <
param name="quality" value="high" />
        <
param name="play" value="true" />
        <
param name="loop" value="true" />
        <
param name="bgcolor" value="#ffffff" />
        <
embed src="<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>" width="468" height="60" bgcolor="#f7f187" quality="high" loop="true"  type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer" />
        </
object>
    </
div></p>
    <
p><div align"left"><{$lang_displayscript}></div>
    <
div><textarea name='lienbt' cols='70' rows='4' wrap='VIRTUAL'><a href='<{$xoops_url}>' target='_blank'><img src='<{$xoops_url}>/<{$linktous.path}>/<{$linktous.banner}>' alt='<{$linktous.sitename}>'></a></textarea></div></p>
<{/if}>


save & close

goto XOOPS modules admin and update the wfchannel module. then clear templates_c folder.

now goto wfchannel admin and then upload settings.. now go through the process of uploading your image file.. then goto the link settings page.. scroll down to the banner section and select the swf file you just uploaded from the list.. (ignore the problem of the swf not displaying when you select it)

once done, you should now be able to see the new swf banner on the link to us page.

16
LucaNet
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/1 20:33

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


Hi monty,

first of all, many many thanks for spending your time for my issue.

I have made all of which you said me. Now, I'm able to upload .swf banner, but if I goto "link to us" section, I see the following image:

Resized Image

17
m0nty
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/1 23:01

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


did you update the wf-channel module & empty templates_c?

18
LucaNet
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/1 23:26

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


Yes, I did.

Maybe should I modify Flash version in /wfchannel/templates/wfchannel_linktous.html?



<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id=index width="468" height="60" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=[b][color=CC0000]6,0,65,0[/color][/b]">

19
m0nty
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/1 23:47

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


maybe yeah.. not sure what version the flash file was that i tested with.

let me know.

also add (for debugging)

<p>swf value = <{$linktous.is_swf}></p>

just before <{if $linktous.banner && $linktous.is_swf == 0}>


then update the module/clear templates_c..

then when you goto the link to us screen, just above the banner link etc.. you should see swf value = 1.. the number should be a '1', if it's a '0' then something is wrong in the edits on index.php

20
LucaNet
Re: WF-Channel 1.07 link to us section doesnt "work" with .swf banners.
  • 2006/11/2 0:35

  • LucaNet

  • Friend of XOOPS

  • Posts: 90

  • Since: 2006/5/25


Nothing doing!!!

Login

Who's Online

190 user(s) are online (126 user(s) are browsing Support Forums)


Members: 0


Guests: 190


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits