|
From: FlorinCB <ory...@us...> - 2008-10-04 07:09:17
|
Update of /cvsroot/mxbb/core/includes/sessions/phpbb3 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv30073/includes/sessions/phpbb3 Modified Files: core.php login.php session.php Added Files: bbcode.php Log Message: new Mx_BBcode merged in one backend file Index: core.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb3/core.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** core.php 12 Sep 2008 05:17:57 -0000 1.13 --- core.php 4 Oct 2008 07:04:25 -0000 1.14 *************** *** 23,31 **** // - // Now load some bbcodes, to be extended for this backend (see below) - // - include_once($mx_root_path . 'includes/mx_functions_bbcode.' . $phpEx); // BBCode associated functions - - // // Finally, load some backend specific functions // --- 23,26 ---- *************** *** 201,205 **** // Load phpbb config.php (to get table prefix) // ! @include_once($phpbb_root_path . 'config.' . $phpEx); // --- 196,200 ---- // Load phpbb config.php (to get table prefix) // ! include_once($phpbb_root_path . 'config.' . $phpEx); // *************** *** 717,721 **** } else ! { $sql = "SELECT * FROM " . CONFIG_TABLE; --- 712,723 ---- } else ! { ! if (!defined('CONFIG_TABLE')) ! { ! global $table_prefix, $mx_root_path, $phpEx; ! ! include($mx_root_path . 'includes/sessions/phpbb3/constants.' . $phpEx); ! } ! $sql = "SELECT * FROM " . CONFIG_TABLE; *************** *** 915,1129 **** } ! /** ! * MXP BBcodes ! * @package MX-Publisher ! */ ! class mx_bbcode extends bbcode_base ! { ! var $smiley_path_url = ''; ! var $smiley_root_path = ''; ! ! var $smiley_url = 'smiley_url'; ! var $smiley_id = 'smiley_id'; ! var $emotion = 'emotion'; ! ! function mx_bbcode() ! { ! global $board_config, $phpbb_root_path; ! ! $this->smiley_path_url = PHPBB_URL; //change this to PORTAL_URL when shared folder will be removed ! $this->smiley_root_path = $phpbb_root_path; //same here ! $board_config['smilies_path'] = str_replace("smiles", "smilies", $board_config['smilies_path']); ! } ! ! /** ! * Generate smilies. ! * ! * Hacking generate_smilies from phpbb/includes/functions_post(ing).php ! * ! * @param string $mode ! * @param integer $page_id ! * ! * Fill smiley templates (or just the variables) with smilies, either in a window or inline ! */ ! function generate_smilies($mode, $forum_id) ! { ! global $mx_page, $board_config, $template, $mx_root_path, $phpbb_root_path, $phpEx; ! global $db, $lang, $images, $theme; ! global $user_ip, $session_length, $starttime; ! global $userdata, $phpbb_auth, $mx_user; ! ! $inline_columns = 4; ! $inline_rows = 5; ! $window_columns = 8; ! ! if ($mode == 'window') ! { ! $mx_user->init($user_ip, PAGE_INDEX); ! ! $gen_simple_header = TRUE; ! $page_title = $lang['Emoticons']; ! ! if ($forum_id) ! { ! $sql = 'SELECT forum_style ! FROM ' . FORUMS_TABLE . " ! WHERE forum_id = $forum_id"; ! $result = $db->sql_query_limit($sql, 1); ! $row = $db->sql_fetchrow($result); ! $db->sql_freeresult($result); ! ! $mx_user->setup('posting', (int) $row['forum_style']); ! } ! else ! { ! $mx_user->setup('posting'); ! } ! ! include($mx_root_path . 'includes/page_header.'.$phpEx); ! ! $template->set_filenames(array( ! 'smiliesbody' => 'posting_smilies.html') ! ); ! } ! ! $display_link = false; ! if ($mode == 'inline') ! { ! $sql = 'SELECT smiley_id ! FROM ' . SMILIES_TABLE . ' ! WHERE display_on_posting = 0'; ! $result = $db->sql_query_limit($sql, 1, 0, 3600); ! ! if ($row = $db->sql_fetchrow($result)) ! { ! $display_link = true; ! } ! $db->sql_freeresult($result); ! } ! ! $last_url = ''; ! ! $sql = 'SELECT * ! FROM ' . SMILIES_TABLE . ! (($mode == 'inline') ? ' WHERE display_on_posting = 1 ' : '') . ' ! ORDER BY smiley_order'; ! ! //phpBB2 code start ! if ($result = $db->sql_query($sql)) ! { ! $num_smilies = 0; ! $rowset = array(); ! while ($row = $db->sql_fetchrow($result)) ! { ! if (empty($rowset[$row['smiley_url']])) ! { ! $rowset[$row['smiley_url']]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row['code'])); ! $rowset[$row['smiley_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' => $this->smiley_path_url . $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' => mx3_append_sid(PHPBB_URL . "posting.$phpEx", "mode=smilies")) ! ); ! } ! ! $template->assign_vars(array( ! 'L_EMOTICONS' => $lang['Emoticons'], ! 'L_CLOSE_WINDOW' => $lang['Close_window'], ! 'S_SMILIES_COLSPAN' => $s_colspan) ! ); ! } ! } ! ! /* ! $result = $db->sql_query($sql, 3600); ! ! $smilies = array(); ! while ($row = $db->sql_fetchrow($result)) ! { ! if (empty($smilies[$row['smiley_url']])) ! { ! $smilies[$row['smiley_url']] = $row; ! } ! } ! $db->sql_freeresult($result); ! ! if (sizeof($smilies)) ! { ! foreach ($smilies as $row) ! { ! $template->assign_block_vars('smiley', array( ! 'SMILEY_CODE' => $row['code'], ! 'A_SMILEY_CODE' => addslashes($row['code']), ! 'SMILEY_IMG' => $this->smiley_root_path . $board_config['smilies_path'] . '/' . $row['smiley_url'], ! 'SMILEY_WIDTH' => $row['smiley_width'], ! 'SMILEY_HEIGHT' => $row['smiley_height'], ! 'SMILEY_DESC' => $row['emotion']) ! ); ! } ! } - //What we do here with forum_id versus page_id ? - if ($mode == 'inline' && $display_link) - { - $template->assign_vars(array( - 'S_SHOW_SMILEY_LINK' => true, - 'U_MORE_SMILIES' => mx3_append_sid(PHPBB_URL . "posting.$phpEx", 'mode=smilies&f=' . $forum_id)) - ); - } - */ - if ($mode == 'window') - { - $template->pparse('smiliesbody'); - include($mx_root_path . 'includes/page_tail.'.$phpEx); - } - } - } ?> \ No newline at end of file --- 917,925 ---- } ! // ! // Now load some bbcodes, to be extended for this backend (see below) ! // ! include_once($mx_root_path . 'includes/sessions/phpbb3/bbcode.' . $phpEx); // BBCode associated functions ?> \ No newline at end of file --- NEW FILE: bbcode.php --- <?php /** * * @package Functions_phpBB * @version $Id: bbcode.php,v 1.1 2008/10/04 07:04:25 orynider Exp $ * @copyright (c) 2002-2008 MX-Publisher Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * @link http://www.mx-publisher.com * */ if (!defined('IN_PORTAL')) { exit; } // // Here comes a mxp version of original phpbb2 bbcode.php // Last in file are the mxp wrapper functions [...1660 lines suppressed...] } //What we do here with forum_id versus page_id ? if ($mode == 'inline' && $display_link) { $template->assign_vars(array( 'S_SHOW_SMILEY_LINK' => true, 'U_MORE_SMILIES' => mx3_append_sid(PHPBB_URL . "posting.$phpEx", 'mode=smilies&f=' . $forum_id)) ); } */ if ($mode == 'window') { $template->pparse('smiliesbody'); include($mx_root_path . 'includes/page_tail.'.$phpEx); } } } ?> |