|
Page 1 of 1
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 FAP CUSTOMIZATION - Pagination Of Smiley Window In FAP?
So I can not believe no one has been annoyed by this tiny issue where when one clicks on the "view all smilie" pop up, has to wait for all smilies to be uploaded? I have tons of smilies, but that is becaues I have a Smiley management MOD that categorizes my smilies. FAP doesn't 'work' with this MOD... apparently FAP is using it's own smiley functions ...at least I think that is the case.
Any ideas, clues. . ?
|
#1 Sat 08 Sep, 2007 03:12 |
|
Sponsors

|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: Pagination Of Smiley Window In FAP?
FAP is using a duplicated function of standard phpBB.
The function has been duplicated to avoid modifying to many phpBB core files. That's why.
I guess you may try to apply that mod to FAP as well. The code should be similar.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#2 Sun 09 Sep, 2007 01:48 |
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 Re: Pagination Of Smiley Window In FAP?
Yeah I tried doing that, but it's not easy thing to do. I just cant believe this doesn't bugg anyone else. Must be just me
|
#3 Thu 20 Sep, 2007 03:33 |
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: Pagination Of Smiley Window In FAP?
Yeah I tried doing that, but it's not easy thing to do. I just cant believe this doesn't bugg anyone else. Must be just me 
Why?
The code for smileys should be really similar (I guess 99%) to the standard phpBB smiley code... what you can't find?
Try to post here, we will try to help.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#4 Fri 21 Sep, 2007 00:15 |
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 Re: Pagination Of Smiley Window In FAP?
Okay, according to the mod it replaces two things. one in bbcode.php and the other in functions_post.php
Quote: Complete new function generate_smilies
Below are the major edits done.
#-----[ OPEN ]-----------------------------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]-----------------------------------------------------------------
# This is the complete smilies_pass function
#
//
// Smilies code ... would this be better tagged on to the end of bbcode.php?
// Probably so and I'll move it before B2
//
function smilies_pass($message)
{
static $orig, $repl;
if (!isset($orig))
{
global $db, $board_config;
$orig = $repl = array();
$sql = 'SELECT * FROM ' . SMILIES_TABLE;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);
if (count($smilies))
{
usort($smilies, 'smiley_sort');
}
for ($i = 0; $i < count($smilies); $i++)
{
$orig[] = "/(?<=.W|W.|^W)" . preg_quote($smilies[$i]['code'], "/") . "(?=.W|W.|W$)/";
$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
}
}
if (count($orig))
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}
return $message;
}
#
#-----[ REPLACE WITH ]---------------------------------------------------------
# Complete new function
#
//START MOD Smiley_management
//
// Smilies code
//
function smilies_pass($message)
{
static $orig, $repl;
if (!isset($orig))
{
// EDIT MSTheme: smilies are in templates/..../images/smiles
global $db, $board_config, $theme, $userdata;
$orig = $repl = array();
//Smilies for parsing: No hidden pages (hidden > ADMIN) (assumed duplicate pages),
//and get only 1 of each themed set.
$style = ($userdata['user_style']) ? $userdata['user_style'] : $board_config['default_style'];
$sql = "SELECT s.*
FROM " . SMILIES_TABLE . " s, " . SMILIES_PAGES_TABLE . " p
WHERE p.id = s.page
AND code <> '' and smile_url <> ''
AND access IN(" . USER . ', ' . MOD . ', ' . ADMIN . ")
AND (theme = 0 OR theme = $style)
ORDER BY code";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);
for ($i = 0; $i < count($smilies); $i++)
{
if (strpos($smilies[$i]['code'], ' ')>0) //multiple codes?
{ //Get all codes, create more records, sorting must be absolute correct
$all_code = explode(' ', $smilies[$i]['code']);
for ($k=1;$k<count($all_code);$k++)
{
$smilies[$i]['code'] = $all_code[$k]; //set code
$smilies[] = $smilies[$i]; //add record
}
$smilies[$i]['code'] = $all_code[0]; //set first code
}
}
if (count($smilies)) usort($smilies, 'smiley_sort');
$smilies_path = $board_config['smilies_path']; //"images/smiles";//###
for ($i = 0; $i < count($smilies); $i++)
{
$orig[] = "/(?<=.W|W.|^W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.W|W.|W$)/";
switch ($smilies[$i]['align'])
{
case 0: $align="-3px;";break;
case 1: $align="top";break;
case 2: $align="middle";break;
case 3: $align="bottom";break;
}
$align = 'style="vertical-align:' . $align . '"';
$repl[] = '<img src="'. $smilies_path . '/' . $smilies[$i]['smile_url']
. '" title="' . $smilies[$i]['emoticon'] . '" alt="[' . $smilies[$i]['emoticon']
. ']" border="0" ' . $align . ' />';
}
}
if (count($orig))
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}
return $message;
}
//END MOD Smiley_management
and Functions_post.php
#-----[ OPEN ]-----------------------------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]-----------------------------------------------------------------
# Complete function generate_smilies
#
//
// Fill smiley templates (or just the variables) with smileys
// Either in a window or inline
//
function generate_smilies($mode, $page_id)
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $user_ip, $session_length, $starttime;
global $userdata;
$inline_columns = 4;
$inline_rows = 5;
$window_columns = 8;
if ($mode == 'window')
{
$userdata = session_pagestart($user_ip, $page_id);
init_userprefs($userdata);
$gen_simple_header = TRUE;
$page_title = $lang['Emoticons'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'smiliesbody' => 'posting_smilies.tpl')
);
}
$sql = "SELECT emoticon, code, smile_url
FROM " . SMILIES_TABLE . "
ORDER BY smilies_id";
if ($result = $db->sql_query($sql))
{
$num_smilies = 0;
$rowset = array();
while ($row = $db->sql_fetchrow($result))
{
if (empty($rowset[$row['smile_url']]))
{
$rowset[$row['smile_url']]['code'] = str_replace("'", "'", str_replace('', '\', $row['code']));
$rowset[$row['smile_url']]['emoticon'] = $row['emoticon'];
$num_smilies++;
}
}
if ($num_smilies)
{
$smilies_count = ($mode == 'inline') ? min(19, $num_smilies) : $num_smilies;
$smilies_split_row = ($mode == 'inline') ? $inline_columns - 1 : $window_columns - 1;
$s_colspan = 0;
$row = 0;
$col = 0;
while (list($smile_url, $data) = @each($rowset))
{
if (!$col)
{
$template->assign_block_vars('smilies_row', array());
}
$template->assign_block_vars('smilies_row.smilies_col', array(
'SMILEY_CODE' => $data['code'],
'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $smile_url,
'SMILEY_DESC' => $data['emoticon'])
);
$s_colspan = max($s_colspan, $col + 1);
if ($col == $smilies_split_row)
{
if ($mode == 'inline' && $row == $inline_rows - 1)
{
break;
}
$col = 0;
$row++;
}
else
{
$col++;
}
}
if ($mode == 'inline' && $num_smilies > $inline_rows * $inline_columns)
{
$template->assign_block_vars('switch_smilies_extra', array());
$template->assign_vars(array(
'L_MORE_SMILIES' => $lang['More_emoticons'],
'U_MORE_SMILIES' => append_sid("posting.$phpEx?mode=smilies"))
);
}
$template->assign_vars(array(
'L_EMOTICONS' => $lang['Emoticons'],
'L_CLOSE_WINDOW' => $lang['Close_window'],
'S_SMILIES_COLSPAN' => $s_colspan)
);
}
}
if ($mode == 'window')
{
$template->pparse('smiliesbody');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------------------
# Complete new function generate_smilies
#
//START MOD Smiley_management
//
// Fill smiley templates for window or inline
//
function generate_smilies($mode, $page_id, $page_id = 0) //Called from posting.php and privmsg.php
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $user_ip, $session_length, $starttime;
global $userdata;
$inline_columns = 4;
$inline_rows = 5;
//******* Get data *******//
if ($mode == 'window')
{
//Initialise separate form
$userdata = session_pagestart($user_ip, $page_id);
init_userprefs($userdata);
$gen_simple_header = TRUE;
}
//Get page list for both window and inline
$style = ($userdata['user_style']) ? $userdata['user_style'] : $board_config['default_style'];
$access = ' access = ' . USER ;
switch ($userdata['user_level'])
{
case MOD: $access = ' access IN (' . USER . ',' . MOD . ')'; break;
case ADMIN: $access = ' access IN (' . USER . ',' . MOD . ',' . ADMIN . ')'; break;
}
$sql = "SELECT *
FROM " . SMILIES_PAGES_TABLE . "
WHERE $access
AND (theme = 0 OR theme = $style)
ORDER BY `default_page` DESC,title";
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't obtain smileys page list", "", __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrowset($result);
if ($mode == 'window')
{
$verified = 0;
for ($i=0;$i<count($row);$i++) //Check page_id
{
//echo $row[$i]['title'] . "||" . $row[$i]['default_page'] , '<br />';
if ($page_id == 0)
{
if ($row[$i]['default_page'] ) $page_id = $row[$i]['id'];
}
if ($row[$i]['id'] == $page_id) $verified = 1;
}
// echo $page_id.'<br />';
if (($page_id == 0 || $verified == 0) && count($row) > 0) $page_id = $row[0]['id'];
$url = "posting.$phpEx?mode=smilies&page=";
for ($i=0;$i<count($row);$i++) //Build list
{
$page_list .= ($page_list ? ' :: ' : '');
$page_list .= '<a href="' . $url . $row[$i]['id'] . '" >' . $row[$i]['title'] . '</a>';
if ($row[$i]['id']==$page_id) $page_data = $row[$i];
}
$page_title = $lang['Emoticons'] . ($page_data['title'] ? ' * ' . $page_data['title'] : '');
$page_width = $page_data['width'];
$page_height = $page_data['height'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'smiliesbody' => 'posting_smilies.tpl')
);
//Get smilies
$sql = "SELECT *
FROM " . SMILIES_TABLE . "
WHERE code <> '' AND smile_url <> '' AND page = $page_id
ORDER BY number";
}
else //$mode == 'inline'
{
//First record is first default page
$page_width = $row[0]['width'];
$page_height = $row[0]['height'];
$style = ($userdata['user_style']) ? $userdata['user_style'] : $board_config['default_style'];
$sql = "SELECT s.*
FROM " . SMILIES_TABLE . " s, " . SMILIES_PAGES_TABLE . " p
WHERE p.id = s.page
AND code <> '' AND smile_url <> '' AND inline = 1
AND $access
AND (theme = 0 OR theme = $style)
ORDER BY number
LIMIT " . ($inline_columns * $inline_rows);
}
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't obtain smileys list", "", __LINE__, __FILE__, $sql);
}
$smilies = $db->sql_fetchrowset($result);
//****** Fill template *******//
$smilies_colspan = ($mode == 'inline') ? $inline_columns : $page_data['column_count'];
$smilies_path = $board_config['smilies_path'];
$row = 0; $col = 0;
for ($i=0;$i<count($smilies);$i++)
{
$all_code = explode(' ', $smilies[$i]['code']); //Select first code only from multiple to insert
$code = str_replace("'", "'", str_replace('', '\', $all_code[0]));
$colspan = ($smilies[$i]['colspan'] ? $smilies[$i]['colspan'] : 1);
if ($col==0) $template->assign_block_vars('smilies_row', array());
$template->assign_block_vars('smilies_row.smilies_col', array(
'SMILEY_CODE' => $code,
'SMILEY_IMG' => $smilies_path . '/' . $smilies[$i]['smile_url'],
'SMILEY_DESC' => $smilies[$i]['emoticon'],
'SMILEY_COLSPAN' => $colspan)
);
$col += $colspan;
if ( $col >= $smilies_colspan) {$col = 0; $row++; }
} //Next smiley
//More smilies button * Can't check if there are more smilies than just inline, assume there are:
if ($mode == 'inline')
{
$template->assign_block_vars('switch_smilies_extra', array());
$template->assign_vars(array(
'L_MORE_SMILIES' => $lang['More_emoticons'],
'U_MORE_SMILIES' => append_sid("posting.$phpEx?mode=smilies"))
);
}
$template->assign_vars(array(
'S_PAGE_WIDTH' => $page_width,
'S_PAGE_HEIGHT' => $page_height,
'S_PAGE_LIST' => $page_list,
'S_SMILIES_COLSPAN' => $smilies_colspan,
'L_EMOTICONS' => $lang['Emoticons'],
'L_CLOSE_WINDOW' => $lang['Close_window'])
);
//Parse separate template
if ($mode == 'window')
{
$template->pparse('smiliesbody');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
}
//END MOD Smiley_management
|
#5 Fri 26 Oct, 2007 07:42 |
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 Re: Pagination Of Smiley Window In FAP?
Yeah... so I cant figure it out... I had coded the smilies url so that I get my smilies categories showing up right, but now trying to figure out how to get the smilies to be posted on the message body because when I click on a smilie, nothing happens... so..
I did this to album_functions.php
#-----[ OPEN ]-----------------------------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]-----------------------------------------------------------------
#
define('SMILIES_TABLE', $table_prefix.'smilies');
#
#-----[ AFTER, ADD ]-----------------------------------------------------------
#
//MOD Smiley_management
define('SMILIES_PAGES_TABLE', $table_prefix.'smilies_pages');
Replaced this part of album_functions.php with the MOD instructions ( post above this one )
//to have smilies window popup
function generate_smilies_album($mode, $page_id) //borrowed from phpbbforums...modified to work with album
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $user_ip, $session_length, $starttime;
global $userdata;
// Vars needed for CH 2.1.4
global $config, $user, $censored_words, $icons, $navigation, $themes, $smilies;
$inline_columns = 4;
$inline_rows = 5;
$window_columns = 8;
... etc etc etc ...
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
}
}
Still nothing.... please, if you read this, can you hint something my way..
|
#6 Tue 04 Dec, 2007 13:28 |
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 Re: Pagination Of Smiley Window In FAP?
Okay, not the kinda hint I was looking for.
How about this. What makes a smilies code get pasted onto the message box?
|
#7 Tue 11 Dec, 2007 07:35 |
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: Pagination Of Smiley Window In FAP?
Okay, not the kinda hint I was looking for.
How about this. What makes a smilies code get pasted onto the message box?
It is a JAVASCRIPT.
Are you using Icy Phoenix or phpBB?
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#8 Sun 16 Dec, 2007 01:23 |
|
Pete_Z 
Joined: January 2007
Posts: 46
|
 Re: Pagination Of Smiley Window In FAP?
Sorry for the lates reply. between work and school, its dificult to keep up with my favorite support sites! I use regular phpbb board... but you know, I will just leave it the way it is. thank you for your time!
|
#9 Wed 30 Jan, 2008 01:20 |
|
|
Page 1 of 1
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
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
|
|
|
|