Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Add LastFM Charts To Icy Phoenix 
 
Hi people!
Here is the mod for Icy Phoenix, which will show your (or someone else's) LastFM charts in posts. It will add new button in posting screen, and it will add new bbcode tag ([lastfm type=chart_type color=chart_color]LastFM username[/lastfm]) to your Icy Phoenix. Mod is based on [youtube] and [flash] tags by MG, and is tested on fresh IP 1.1.0.15a. While first version of the mod only accepted username as input (while other parameters were hardcoded), this release brings selection of chart type and color while posting. At the moment, you have to enter these parameters manually (there is list of available parameters in helpscreen during code insertion), but I want to make radiobuttons or dropdown list where you can choose from available options. I expect your help in doing this guys, because I'm not very skilled in php . If anybody could give me some hint on how to do this I would be extremly grateful.

I provided premodded installation, because there is more than few files to be edited. Also, I wrote installation procedure  by phpbb standards, so you can install mod even if you changed some of the files after Icy Phoenix installation.

This is the first mod I have ever made, so try not to be too harsh, guys . If I made some mistake in code itself, or in a way I presented this mod, please point me in the right direction. Thanx for all the effort you put in this community, in helping us, and for keeping Icy Phoenix best phpbb system around.
Code: [Download] [Hide] [Select]
##############################################################
## MOD Title: LastFM Chart
## MOD Author: Gandalf < gandalf@omarska.net > http://www.omarska.net
## MOD Description: Adds a button and bbcode tag that enables users to display LastFM Charts in posts
##
## MOD Version: 0.4
##
## Installation Level: Easy
## Installation Time: ~10 Minutes
## Files To Edit:     templates/mg_themes/bbcb_mg.tpl
##                    language/lang_english/bbcb_mg.js
##                    language/lang_english/lang_bbcb_mg.php
##                    includes/bbcb_mg.php
##                    includes/bbcb_mg_small.php
##                    includes/bbcode.php
## Included Files:    lastfm.gif
##
##
## License: http://opensource.org/licenses/GPL-license.php GNU General Public License v2
##############################################################
## Author Notes:
##
## Note:
## This mod is for all users that would like to add LastFM playlists to their posts
##
##############################################################
## MOD History:
##
##   2007-06-16 - Version 0.4
##          Added selection of chart type and color
##          Added some lang vars
##          Removed album_bbcode.php editing
##          Optimized code changes
##   2007-06-13 - Version 0.1
##          Mod created
##              
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ COPY ]------------------------------------------
#

copy lastfm.gif to images/bbcb_mg/images/gif/

#
#-----[ OPEN ]------------------------------------------
#

templates/mg_themes/bbcb_mg.tpl

#
#-----[ FIND ]------------------------------------------
#

<a href="javascript:BBCyoutube()"><img border="0" src="{BBCB_MG_IMG_PATH}youtube{BBCB_MG_IMG_EXT}" name="youtube" onMouseOver="helpline('youtube')" alt="{L_BBCB_MG_YOUTUBE}" title="{L_BBCB_MG_YOUTUBE}" class="bbimages" /></a>

#
#-----[ AFTER, ADD ]------------------------------------
#

<a href="javascript:BBClastfm()"><img border="0" src="{BBCB_MG_IMG_PATH}lastfm{BBCB_MG_IMG_EXT}" name="lastfm" onMouseOver="helpline('lastfm')" alt="{L_BBCB_MG_LASTFM}" title="{L_BBCB_MG_LASTFM}" class="bbimages" /></a>


#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/bbcb_mg.js

#
#-----[ FIND ]------------------------------------------
#

s_youtube_insert = 'Please write YouTube file ID';

#
#-----[ AFTER, ADD ]------------------------------------
#

s_lastfm_insert = 'Please write LastFM username';
s_lastfm_insert_error = 'You didn't specify LastFM username';
s_lastfm_t_insert = 'Please specify chart type. Available types: recenttracks, weeklyartistchart, weeklytrackchart, topartists, toptracks';
s_lastfm_t_error = 'You didn't specify chart type';
s_lastfm_c_insert = 'Please specify chart color. Available colors: red, blue, black, grey';
s_lastfm_c_error = 'You didn't specify chart color';
s_lastfm_insert_tip = 'username';
s_lastfm_t_insert_tip = 'recenttracks';
s_lastfm_c_insert_tip = 'red';

#
#-----[ FIND ]------------------------------------------
#

s_youtube_help = 'Insert YouTube video file: [youtube]YouTube ID[/youtube]';

#
#-----[ AFTER, ADD ]------------------------------------
#

s_lastfm_help = 'Insert LastFM Chart: [lastfm type=chart_type color=chart_color]LastFM username[/lastfm]';

#
#-----[ FIND ]------------------------------------------
#

var youtube = 0;

#
#-----[ AFTER, ADD ]------------------------------------
#

var lastfm = 0;

#
#-----[ FIND ]------------------------------------------
#

'[youtube]','[/youtube]',

#
#-----[ AFTER, ADD ]------------------------------------
#

'[lastfm type=recenttracks color=red]','[/lastfm]',

#
#-----[ FIND ]------------------------------------------
#

function BBCyoutube()
{
    var FoundErrors = '';
    var enterURL = prompt(s_youtube_insert, s_id_insert_tip);
    if (!enterURL)
    {
        FoundErrors += s_id_insert_error;
    }
    if (FoundErrors)
    {
        alert(s_gen_error + FoundErrors);
        return;
    }
    var ToAdd = "[youtube]"+enterURL+"[/youtube]";
    PostWrite(ToAdd);
}


#
#-----[ AFTER, ADD ]------------------------------------
#

function BBClastfm()
{
    var FoundErrors = '';
    var enterFURL = prompt(s_lastfm_insert, s_lastfm_insert_tip);
    if (!enterFURL)
    {
        FoundErrors += s_lastfm_insert_error;
    }
    var enterT = prompt(s_lastfm_t_insert, s_lastfm_t_insert_tip);
    if (!enterT)
    {
        FoundErrors += s_lastfm_t_error;
    }
    var enterC = prompt(s_lastfm_c_insert, s_lastfm_c_insert_tip);
    if (!enterC)
    {
        FoundErrors += s_lastfm_c_error;
    }
    if (FoundErrors)
    {
        alert(s_gen_error + FoundErrors);
        return;
    }
    var ToAdd = "[lastfm type="+enterT+" color="+enterC+"]"+enterFURL+"[/lastfm]";
    PostWrite(ToAdd);
}

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_bbcb_mg.php

#
#-----[ FIND ]------------------------------------------
#

$lang['bbcb_mg_youtube'] = 'YouTube';

#
#-----[ AFTER, ADD ]------------------------------------
#

$lang['bbcb_mg_lastfm'] = 'LastFM';

#
#-----[ FIND ]------------------------------------------
#


$lang['s_flash_h_error'] = 'You didn't specify Flash file height';


#
#-----[ AFTER, ADD ]------------------------------------
#


$lang['s_lastfm_insert'] = 'Please specify LastFM username';
$lang['s_lastfm_insert_error'] = 'You didn't specify LastFM username';
$lang['s_lastfm_t_insert'] = 'Please specify chart type. Available types: recenttracks, weeklyartistchart, weeklytrackchart, topartists, toptracks';
$lang['s_lastfm_t_error'] = 'You didn't specify chart type';
$lang['s_lastfm_c_insert'] = 'Please specify chart color. Available colors: red, blue, black, grey';
$lang['s_lastfm_c_error'] = 'You didn't specify chart color';


#
#-----[ FIND ]------------------------------------------
#


$lang['s_youtube_help'] = 'Insert YouTube file: [youtube]YouTube ID[/youtube]';


#
#-----[ AFTER, ADD ]------------------------------------
#


$lang['s_lastfm_help'] = 'Insert LastFm Chart: [lastfm type=chart_type color=chart_color]LastFM username[/lastfm]';

                
#
#-----[ OPEN ]------------------------------------------
#

includes/bbcode.php
    
#
#-----[ FIND ]------------------------------------------
#

            'youtube' => array(
                    'nested' => true,
                    'inurl' => true,
                    'allow_empty' => false,
                    ),

#
#-----[ AFTER, ADD ]------------------------------------
#

            'lastfm' => array(
                    'nested' => true,
                    'inurl' => true,
                    'allow_empty' => false,
                    ),

#
#-----[ FIND ]------------------------------------------
#

                if($this->is_sig)
                {
                    return $error;
                }
                if(isset($item['params']['param']))
                {
                    $content = $item['params']['param'];
                }
                $content = $this->process_text($content);


#
#-----[ AFTER, ADD ]------------------------------------
#

                if(isset($item['params']['type']))
                {
                    $type = $item['params']['type'];

                    {
                    $type = $this->process_text($type);
                    }
                }    
                if(isset($item['params']['color']))
                {
                    $color = $item['params']['color'];
                    {
                    $color = $this->process_text($color);
                    }

                }

#
#-----[ FIND ]------------------------------------------
#

// FLASH, SWF, VIDEO, REAL, QUICK, STREAM, EMFF, YOUTUBE, GOOGLEVIDEO
            if( ($tag === 'flash') || ($tag === 'swf') || ($tag === 'video') || ($tag === 'ram') || ($tag === 'quick') || ($tag === 'stream') || ($tag === 'emff') || ($tag === 'mp3') || ($tag === 'youtube') || ($tag === 'googlevideo') )
            {

#
#-----[ REPLACE WITH ]------------------------------------
#

// FLASH, SWF, VIDEO, REAL, QUICK, STREAM, EMFF, YOUTUBE, LASTFM, GOOGLEVIDEO
            if( ($tag === 'flash') || ($tag === 'swf') || ($tag === 'video') || ($tag === 'ram') || ($tag === 'quick') || ($tag === 'stream') || ($tag === 'emff') || ($tag === 'mp3') || ($tag === 'youtube') || ($tag === 'lastfm') || ($tag === 'googlevideo') )
            {
            
#
#-----[ FIND ]------------------------------------------
#

                if ( ($tag === 'flash') || ($tag === 'swf') )

                {
                    $html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' . $width . '" height="' . $height . '"><param name=movie value="' . $content . '"><param name=quality value=high><param name=scale value=noborder><param name=wmode value=transparent><param name=bgcolor value=#000000><embed src="' . $content . '" quality=high scale=noborder wmode=transparent bgcolor=#000000 width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed></object>';
                }

#
#-----[ AFTER, ADD ]------------------------------------
#

                elseif  ($tag === 'lastfm')
                {
                    $html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="184" height="179" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab%23version=7,0,0,0"><param name="bgcolor" value="#999999" /><param name="movie" value="http://panther1.last.fm/widgets/chart/2.swf" /><param name="quality" value="high" /><param name="FlashVars" value="type=' . $type . '&amp;user=' . $content . '&amp;theme=' . $color . '" /><embed src="http://panther1.last.fm/widgets/chart/2.swf" type="application/x-shockwave-flash" name="widgetPlayer" bgcolor="#999999" width="184" height="179" quality="high" FlashVars="type=' . $type . '&amp;user=' .$content . '&amp;theme=' . $color . '" ></embed></object>';
                }    
                
#
#-----[ OPEN ]------------------------------------------
#

includes/bbcb_mg_small.php
    
#
#-----[ FIND ]------------------------------------------
#

'L_BBCB_MG_YOUTUBE' => $lang['bbcb_mg_youtube'],

#
#-----[ AFTER, ADD ]------------------------------------
#

'L_BBCB_MG_LASTFM' => $lang['bbcb_mg_lastfm'],
        
#
#-----[ FIND ]------------------------------------------
#

'L_FLASH_H_ERROR' => $lang['s_flash_h_error'],
    
#
#-----[ AFTER, ADD ]------------------------------------
#

'L_LASTFM_INSERT' => $lang['s_lastfm_insert'],
'L_LASTFM_INSERT_ERROR' => $lang['s_lastfm_insert_error'],
'L_LASTFM_T_INSERT' => $lang['s_lastfm_t_insert'],
'L_LASTFM_T_ERROR' => $lang['s_lastfm_t_error'],
'L_LASTFM_C_INSERT' => $lang['s_lastfm_c_insert'],
'L_LASTFM_C_ERROR' => $lang['s_lastfm_c_error'],

#
#-----[ FIND ]------------------------------------------
#

'L_YOUTUBE_HELP' => $lang['s_youtube_help'],

    
#
#-----[ AFTER, ADD ]------------------------------------
#

'L_LASTFM_HELP' => $lang['s_lastfm_help'],    

#
#-----[ OPEN ]------------------------------------------
#

includes/bbcb_mg.php
    
#
#-----[ FIND ]------------------------------------------
#

'L_BBCB_MG_YOUTUBE' => $lang['bbcb_mg_youtube'],
    
#
#-----[ AFTER, ADD ]------------------------------------
#

'L_BBCB_MG_LASTFM' => $lang['bbcb_mg_lastfm'],

#
#-----[ FIND ]------------------------------------------
#

'L_FLASH_H_ERROR' => $lang['s_flash_h_error'],
    
#
#-----[ AFTER, ADD ]------------------------------------
#

'L_LASTFM_INSERT' => $lang['s_lastfm_insert'],
'L_LASTFM_INSERT_ERROR' => $lang['s_lastfm_insert_error'],
'L_LASTFM_T_INSERT' => $lang['s_lastfm_t_insert'],
'L_LASTFM_T_ERROR' => $lang['s_lastfm_t_error'],
'L_LASTFM_C_INSERT' => $lang['s_lastfm_c_insert'],
'L_LASTFM_C_ERROR' => $lang['s_lastfm_c_error'],
            
#
#-----[ FIND ]------------------------------------------
#

'L_YOUTUBE_HELP' => $lang['s_youtube_help'],
    
#
#-----[ AFTER, ADD ]------------------------------------
#

'L_LASTFM_HELP' => $lang['s_lastfm_help'],
                    
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM

Button image
lastfm

Final result
lastfm_final

Below is premodded installation. Unpack to IP root directory, overwriting all files.

WARNING: only use premodded files if you haven't changed following files (IP 1.1.0.15a):
templates/mg_themes/bbcb_mg.tpl
language/lang_english/bbcb_mg.js
language/lang_english/lang_bbcb_mg.php
includes/bbcb_mg.php
includes/bbcb_mg_small.php
includes/bbcode.php


Also if you have installed first version of the Mod using premodded files, just overwrite existing files.

LastFM.rar
Description: LastFM MOD premodded instalation 
Download
Filename: LastFM.rar
Filesize: 45.9 KB
Downloaded: 271 Time(s)

 




____________
Omarska online
 
Last edited by omarska on Sun 17 Jun, 2007 19:36; edited 3 times in total 
omarskaSend private messageVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post  
 
thanks
moved to customizations
 



 
ZukerSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Add LastFM Recently Listened Tracks To Icy Phoenix (BETA 
 
Thx for this MOD  
 




____________

Play Games at GamesCampus!
 
KugeLSichASend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Add LastFM Charts To Icy Phoenix (BETA) 
 
New version uploaded
 




____________
Omarska online
 
omarskaSend private messageVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events