|
From: Jon O. <jon...@us...> - 2007-06-07 20:14:47
|
Update of /cvsroot/mxbb/mx_tinies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11886 Added Files: db_install.php db_uninstall.php db_upgrade.php faq.php index.html mx_tinies.pak qsearch.php version_history.txt view_topics.php welcome.php Log Message: added mx_tinies --- NEW FILE: index.html --- --- NEW FILE: mx_tinies.pak --- module=+:57=+:Tinies=+:modules/mx_tinies/=+:Tinies version 1.3.0=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:57=+:62=+:Tinies: FAQ=+:=+:faq.php=+: parameter=+:62=+:114=+:Tinies_FAQ_Name=+:Text=+:faq=+:=+:0=+:0 parameter=+:62=+:115=+:Tinies_FAQ_Title=+:Text=+:Forums FAQ=+:=+:0=+:0 parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - Tinies: FAQ=+:Demo block=+:62=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:57=+:61=+:Tinies: Quick Search=+:=+:qsearch.php=+: parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - Tinies: Quick Search=+:Demo block=+:61=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:57=+:60=+:Tinies: Welcome=+:=+:welcome.php=+: parameter=+:60=+:107=+:Tinies_Welcome_Msg=+:Text=+:Have a nice day !=+:=+:0=+:0 parameter=+:60=+:108=+:Tinies_Register_Msg=+:Text=+:Not a member? %sClick here and Register Now!%s=+:=+:0=+:0 parameter=+:60=+:109=+:Tinies_View_JumpTo=+:Boolean=+:FALSE=+:=+:0=+:0 parameter=+:60=+:110=+:Tinies_Vertical_Layout=+:Boolean=+:TRUE=+:=+:0=+:0 parameter=+:60=+:111=+:Tinies_Default_Avatar=+:Text=+:connectthedots.gif=+:=+:0=+:0 parameter=+:60=+:112=+:Tinies_View_PostCount=+:Boolean=+:TRUE=+:=+:0=+:0 parameter=+:60=+:113=+:Tinies_Report_Page=+:Number=+:0=+:=+:0=+:0 parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - Tinies: Welcome=+:Demo block=+:60=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 --- NEW FILE: db_upgrade.php --- <?php /*************************************************************************** * db_upgrade.php * -------------- * begin : May, 2004 * Updated : April 2007 * copyright : Marc Ferran (c) 2003-2004 * module : mx_tinies * file contents : DB Upgrade script (called by Module Admin). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ global $userdata, $phpEx; // // Security Check... // if( !defined('IN_PORTAL') ) { die("Hacking attempt(1)"); } if( !defined('IN_ADMIN') ) { die("Hacking attempt(2)"); } if( !$userdata['session_logged_in'] ) { die("Hacking attempt(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } $message .= '<br />This module does not create any table on your database.'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Upgrade Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: version_history.txt --- ################################################################# ## ## mx_tinies module v.2.0.0RC1 for MX-System Portal 2.8+ ## ## mx_tinies Author: ## - markus_petrux (phpmix at pobox.com) - www.phpmix.org ## ## Updated by: ## - mhewitson - www.mx-system.com ## ## Editor TabSize = 4 ## v.2.0.0 RC1 - 27-04-2007 (mhewitson) - Updated module to work with mxBB 2.8.0 RC1 - Added security to files - Added blank index.html document to directories v.1.3.0 - 2004/06/14 (markus_petrux) - Fixed typo in QuickSearch template (viewtopic.php?t=127). - Added new link PrivMsgs(x) on Welcome block. - Add link to View Latest 24/48/72h on Welcome block. - Fixed buggy post count on Welcome block. v.1.2.0 - 2004/05/24 (markus_petrux) - Changed the name script view_unread.php by view_topics.php. - And now view_topics.php can be run in Block or Standalone mode. - Added "Topics you've Started" as new link in Welcome block. - Added View_Reports_Page as new parameter in Welcome block. v.1.0.1 - 2004/05/20 (markus_petrux) - Added db_xxxx.php scripts. - Added view_unread.php called from welcome block. - Added block parameter to show/hide post counts on Welcome block. v.1.0.0 - 2004/05/03 (markus_petrux) - Very first beta. ## ## ## ################################################################# --- NEW FILE: faq.php --- <?php /*************************************************************************** * faq.php * ------- * begin : October, 2003 * Updated : April 2007 * copyright : Marc Ferran (c) 2003 * module : mx_tinies * file contents : FAQ (Block). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ //some basic security if(!defined('IN_PORTAL')) { die('Hacking attempt'); } // -------------------------------------------------------------------------------- // Block Initialization // -------------------------------------------------------------------------------- $block_title = 'Tinies: FAQ'; if( !function_exists('read_block_config') ) { message_die(GENERAL_ERROR, "This script should be executed as Portal Block.", 'mx_tinies'); } // // Include common module stuff... // include_once($module_root_path . 'includes/common.' . $phpEx); // // Read block Configuration // $block_config = read_block_config($block_id); $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); $faq_name = $block_config[$block_id]['Tinies_FAQ_Name']['parameter_value']; if( empty($faq_name) ) { $faq_name = 'faq'; } $faq_title = $block_config[$block_id]['Tinies_FAQ_Title']['parameter_value']; if( empty($faq_name) ) { $faq_title = strtoupper($faq_name); } // -------------------------------------------------------------------------------- // Block Procedure // -------------------------------------------------------------------------------- // // Load the appropriate faq file // $faq_file = $module_root_path.'faqs/lang_'.$board_config['default_lang'].'/lang_'.$faq_name.'.'.$phpEx; if( !file_exists($faq_file) ) { message_die(GENERAL_ERROR, "Couldn't load FAQ File :<br />$faq_file", ''); } include_once($faq_file); // // Pull the array data from the lang pack // $j = 0; $counter = 0; $counter_2 = 0; $faq_block = array(); $faq_block_titles = array(); for( $i = 0; $i < count($faq); $i++ ) { if( $faq[$i][0] != '--' ) { $faq_block[$j][$counter]['id'] = $counter_2; $faq_block[$j][$counter]['question'] = $faq[$i][0]; $faq_block[$j][$counter]['answer'] = $faq[$i][1]; $counter++; $counter_2++; } else { $j = ( $counter != 0 ) ? $j + 1 : 0; $faq_block_titles[$j] = $faq[$i][1]; $counter = 0; } } // // This is the template used to render this block. // $template->set_filenames(array( 'faq_body' => 'faq_body.tpl') ); for( $i = 0; $i < count($faq_block); $i++ ) { if( count($faq_block[$i]) ) { $template->assign_block_vars('faq_block', array( 'BLOCK_TITLE' => $faq_block_titles[$i]) ); $template->assign_block_vars('faq_block_link', array( 'BLOCK_TITLE' => $faq_block_titles[$i]) ); for( $j = 0; $j < count($faq_block[$i]); $j++ ) { $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('faq_block.faq_row', array( 'ROW_COLOR' => '#'.$row_color, 'ROW_CLASS' => $row_class, 'FAQ_QUESTION' => $faq_block[$i][$j]['question'], 'FAQ_ANSWER' => $faq_block[$i][$j]['answer'], 'U_FAQ_ID' => $faq_block[$i][$j]['id']) ); $template->assign_block_vars('faq_block_link.faq_row_link', array( 'ROW_COLOR' => '#'.$row_color, 'ROW_CLASS' => $row_class, 'FAQ_LINK' => $faq_block[$i][$j]['question'], 'U_FAQ_LINK' => $mx_root_path . 'index.php?page=' . $page_id . '#' . $faq_block[$i][$j]['id']) ); } } } // // Setup common template vars and display the block. // $template->assign_vars(array( 'IMG_SPACER' => $module_root_path.'templates/images/spacer.gif', 'L_FAQ_TITLE' => $faq_title, 'L_BACK_TO_TOP' => $lang['Back_to_top']) ); $template->pparse('faq_body'); ?> --- NEW FILE: db_install.php --- <?php /*************************************************************************** * db_install.php * -------------- * begin : May, 2004 * Updated : April 2007 * copyright : Marc Ferran (c) 2003-2004 * module : mx_tinies * file contents : DB Installation script (called by Module Admin). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ global $userdata, $phpEx; // // Security Check... // if( !defined('IN_PORTAL') ) { die("Hacking attempt(1)"); } if( !defined('IN_ADMIN') ) { die("Hacking attempt(2)"); } if( !$userdata['session_logged_in'] ) { die("Hacking attempt(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } $mx_module_version = '2.0.0 RC'; $mx_module_copy = 'Original mxBB <i>Tinies</i> module by <a href="http://www.phpmix.org" target="_blank">Markus</a>'; $message = "<b>This is a fresh install!</b><br/><br/>"; $sql = array(); $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); $message .= '<br />This module does not create any table on your database.'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Installation Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: db_uninstall.php --- <?php /*************************************************************************** * db_uninstall.php * ---------------- * begin : May, 2004 * Updated : April 2007 * copyright : Marc Ferran (c) 2003-2004 * module : mx_tinies * file contents : DB Uninstallation script (called by Module Admin). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ global $userdata, $phpEx; // // Security Check... // if( !defined('IN_PORTAL') ) { die("Hacking attempt(1)"); } if( !defined('IN_ADMIN') ) { die("Hacking attempt(2)"); } if( !$userdata['session_logged_in'] ) { die("Hacking attempt(3)"); } if( $userdata['user_level'] != ADMIN ) { die("Hacking attempt(4)"); } $message .= '<br />This module does not create any table on your database.'; echo '<br /> <br />'; echo '<table cellpadding="4" cellspacing="1" border="0" class="forumline">'; echo '<tr><th class="thHead" align="center">Module Uninstallation Information</th></tr>'; echo '<tr><td class="row1" align="center"><span class="gen">' . $message . '</span></td></tr>'; echo '</table> <br />'; ?> --- NEW FILE: qsearch.php --- <?php /*************************************************************************** * qsearch.php * ----------- * begin : October, 2003 * Updated : April 2007 * copyright : Marc Ferran (c) 2003 * module : mx_tinies * file contents : Quick Search (Block). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ //Some basic security if(!defined('IN_PORTAL')) { die('Hacking attempt'); } // -------------------------------------------------------------------------------- // Block Initialization // -------------------------------------------------------------------------------- $block_title = 'Tinies: Quick Search'; if( !function_exists('read_block_config') ) { message_die(GENERAL_ERROR, "This script should be executed as Portal Block.", 'mx_tinies'); } // // Include common module stuff... // include_once($module_root_path . 'includes/common.' . $phpEx); // // Read block Configuration // $block_config = $mx_block->get_parameters( 'target_block' ); //$block_config = read_block_config($block_id); $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); // -------------------------------------------------------------------------------- // Block Procedure // -------------------------------------------------------------------------------- // // This is the template used to render this block. // $template->set_filenames(array( 'qsearch_body' => 'qsearch_body.tpl') ); // // Setup common template vars and display the block. // $template->assign_vars(array( 'L_QUICK_SEARCH' => $lang['Quick_search'], 'L_SEARCH' => $lang['Search'], 'L_SEARCH_AT' => $lang['Search_at'], 'L_ADVANCED_SEARCH' => $lang['Advanced_search'], 'U_IMAGES_PATH' => $module_root_path.'templates/images/', 'U_SEARCH' => append_sid(PHPBB_URL.'search.'.$phpEx.'?mode=results'), 'L_FORUM' => $lang['Forum'], 'HOSTNAME' => $_SERVER['HTTP_HOST'], 'SITENAME' => $board_config['sitename']) ); $template->pparse('qsearch_body'); ?> --- NEW FILE: view_topics.php --- <?php /*************************************************************************** * view_topics.php * --------------- * begin : May, 2004 * Updated : April 2007 * copyright : Marc Ferran (c) 2003-2004 * module : mx_tinies * file contents : View Unread/EgoStarted Topics (Block/Standalone). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ // -------------------------------------------------------------------------------- // Initialization // -------------------------------------------------------------------------------- $block_title = 'Tinies: View Topics'; if( function_exists('read_block_config') ) { // // Running as a Block... // $generate_headers = FALSE; $mx_user->init($user_ip, PAGE_INDEX); } else { // // Running Standalone... // define('IN_PORTAL', true); //session_start(); $mx_root_path = "../../"; //include_once($mx_root_path . 'extension.inc'); $phpEx = substr(strrchr(__FILE__, '.'), 1); include_once($mx_root_path . 'common.'.$phpEx); // // Start session management // //$userdata = session_pagestart($user_ip, PAGE_INDEX); //mx_init_userprefs($userdata); $mx_user->init($user_ip, PAGE_INDEX); // // End session management // $block_id = ( !empty($HTTP_GET_VARS['block_id']) ) ? $HTTP_GET_VARS['block_id'] : 0; if( empty($block_id) ) { $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE block_title = '$block_title' LIMIT 1"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Could not query '$block_title' information", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $block_id = $row['block_id']; } $generate_headers = TRUE; } if( !$userdata['session_logged_in'] ) { mx_message_die(GENERAL_ERROR, "You must be logged in to view this report.", 'mx_tinies'); } // // Include common module stuff... // include_once($module_root_path . 'includes/common.' . $phpEx); // // Read block Configuration // //$block_config = read_block_config($block_id); //$block_config = $mx_block->get_parameters( 'block_id' ); //$block_config = read_block_config($block_id); $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); // // Setup proper report... // $report_id = ( isset($HTTP_GET_VARS['report_id']) ) ? $HTTP_GET_VARS['report_id'] : ''; if( $report_id == 'unread' ) { $report_title = $lang['Search_unread']; $report_cond = ' AND p2.post_time > ' . $userdata['user_lastvisit']; } else if( $report_id == 'egostarted' ) { $report_title = $lang['Search_self_topics']; $report_cond = ' AND t.topic_poster = ' . $userdata['user_id']; } else if( $report_id == '24h' ) { $report_title = $lang['View_latest'].' 24h :: '.$lang['Search']; $report_cond = ' AND p2.post_time > ' . ( time() - 86400 ); // Seconds * 1day = (24 * 60 * 60) } else if( $report_id == '48h' ) { $report_title = $lang['View_latest'].' 48h :: '.$lang['Search']; $report_cond = ' AND p2.post_time > ' . ( time() - 172800 ); // Seconds * 2days = (24 * 60 * 60) * 2 } else if( $report_id == '72h' ) { $report_title = $lang['View_latest'].' 72h :: '.$lang['Search']; $report_cond = ' AND p2.post_time > ' . ( time() - 259200 ); // Seconds * 3days = (24 * 60 * 60) * 3 } else { message_die(GENERAL_MESSAGE, $lang['No_search_match']); } // // Build the base query... // $report_from = ' FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . ' u, ' . POSTS_TABLE . ' p, ' . POSTS_TABLE . ' p2, ' . USERS_TABLE . ' u2' . ' WHERE t.topic_poster = u.user_id' . ' AND f.forum_id = t.forum_id' . ' AND p.post_id = t.topic_first_post_id' . ' AND p2.post_id = t.topic_last_post_id' . ' AND u2.user_id = p2.poster_id' . ' AND f.forum_id IN (' . get_auth_forum() . ')' . ' AND t.topic_moved_id = 0' . $report_cond; // // Get the total count of topics, quit if none... // $sql = 'SELECT COUNT(*) AS total'.$report_from; if( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, 'Could not obtain search result', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $total_match_count = $row['total']; $db->sql_freeresult($result); if( $total_match_count <= 0 ) { mx_message_die(GENERAL_MESSAGE, $lang['No_search_match']); } // // Get information about topics visited... // $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); // // Get the list of posts ids since last visit... // $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; $sql = 'SELECT t.*, f.forum_id, f.forum_name,'. ' u.username, u.user_id, u2.username as user2, u2.user_id as id2,'. ' p.post_username, p2.post_username AS post_username2, p2.post_time' . $report_from . ' ORDER BY p2.post_time DESC'. " LIMIT $start, " . $board_config['topics_per_page']; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain search result', '', __LINE__, __FILE__, $sql); } $searchset = array(); while( $row = $db->sql_fetchrow($result) ) { if( $report_id == 'unread' ) { if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { $topic_id = $row['topic_id']; if( !empty($tracking_topics[$topic_id]) ) { if( $tracking_topics[$topic_id] > $row['post_time'] ) { continue; } } $forum_id = $row['forum_id']; if( !empty($tracking_forums[$forum_id]) ) { if( $tracking_forums[$forum_id] > $row['post_time'] ) { continue; } } if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $row['post_time'] ) { continue; } } } } $searchset[] = $row; } $db->sql_freeresult($result); if( $report_id == 'unread' ) { $total_match_count = count($searchset); if( $total_match_count <= 0 ) { mx_message_die(GENERAL_MESSAGE, $lang['No_search_match']); } } // ---------------------------------------- // Actually, the report begins here ;-) // ---------------------------------------- // // Generate header if running standalone... // if( $generate_headers ) { $page_title = $report_title; include($mx_root_path . 'includes/page_header.'.$phpEx); } // // This is the template used to render this block. // $template->set_filenames(array( 'view_topics' => 'view_topics.tpl') ); // // Build the report (based on phpBB search.php)... // make_jumpbox(PHPBB_URL . 'viewforum.'.$phpEx); $l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count); if( $report_id == '24h' || $report_id == '48h' || $report_id == '72h' ) { $l_search_matches = $lang['View_latest']." $report_id :: ".$l_search_matches; } $template->assign_vars(array( 'L_SEARCH_MATCHES' => $l_search_matches, 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), 'U_INDEX' => append_sid(PHPBB_URL . "index.$phpEx"), 'L_TOPIC' => $lang['Topic']) ); for( $i = 0; $i < count($searchset); $i++ ) { $forum_url = append_sid(PHPBB_URL . "viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']); $topic_url = append_sid(PHPBB_URL . "viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id']); $post_url = append_sid(PHPBB_URL . "viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id']) . '#' . $searchset[$i]['post_id']; $post_date = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); $topic_title = $searchset[$i]['topic_title']; $forum_id = $searchset[$i]['forum_id']; $topic_id = $searchset[$i]['topic_id']; $topic_type = $searchset[$i]['topic_type']; if( $topic_type == POST_ANNOUNCE ) { $topic_type = $lang['Topic_Announcement'] . ' '; } else if( $topic_type == POST_STICKY ) { $topic_type = $lang['Topic_Sticky'] . ' '; } else { $topic_type = ''; } if( $searchset[$i]['topic_vote'] ) { $topic_type .= $lang['Topic_Poll'] . ' '; } $views = $searchset[$i]['topic_views']; $replies = $searchset[$i]['topic_replies']; if( ( $replies + 1 ) > $board_config['posts_per_page'] ) { $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] ); $goto_page = ' [ <img src="' . PHPBB_URL . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': '; $times = 1; for( $j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'] ) { $goto_page .= '<a target="_blank" href="' . append_sid(PHPBB_URL . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '">' . $times . '</a>'; if( $times == 1 && $total_pages > 4 ) { $goto_page .= ' ... '; $times = $total_pages - 3; $j += ( $total_pages - 4 ) * $board_config['posts_per_page']; } else if( $times < $total_pages ) { $goto_page .= ', '; } $times++; } $goto_page .= ' ] '; } else { $goto_page = ''; } if ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) { $folder_img = 'folder_locked'; } else if ( $searchset[$i]['topic_type'] == POST_ANNOUNCE ) { $folder_img = 'folder_announce'; } else if ( $searchset[$i]['topic_type'] == POST_STICKY ) { $folder_img = 'folder_sticky'; } else { if ( $replies >= $board_config['hot_threshold'] ) { $folder_img = 'folder_hot'; } else { $folder_img = 'folder'; } } if( $report_id == 'unread' ) { $folder_img .= '_new'; $folder_alt = $lang['New_posts']; $newest_post_img = '<a target="_blank" href="' . append_sid(PHPBB_URL . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . PHPBB_URL . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else // $report_id == 'egostarted' or '24/48/72h' { if( $userdata['session_logged_in'] ) { if( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) { if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { $unread_topics = true; if( !empty($tracking_topics[$topic_id]) ) { if( $tracking_topics[$topic_id] > $searchset[$i]['post_time'] ) { $unread_topics = false; } } if( !empty($tracking_forums[$forum_id]) ) { if( $tracking_forums[$forum_id] > $searchset[$i]['post_time'] ) { $unread_topics = false; } } if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $searchset[$i]['post_time'] ) { $unread_topics = false; } } if( $unread_topics ) { $folder_img .= '_new'; $folder_alt = $lang['New_posts']; $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else if( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] ) { $folder_img .= '_new'; $folder_alt = $lang['New_posts']; $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } $topic_author = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a target="_blank" href="' . append_sid(PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $searchset[$i]['user_id']) . '">' : ''; $topic_author .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] ); $topic_author .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : ''; $first_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['topic_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']); $last_post_author = ( $searchset[$i]['id2'] == ANONYMOUS ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a target="_blank" href="' . append_sid(PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $searchset[$i]['id2']) . '">' . $searchset[$i]['user2'] . '</a>'; $last_post_url = '<a target="_blank" href="' . append_sid(PHPBB_URL . "viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['topic_last_post_id']) . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . PHPBB_URL . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $template->assign_block_vars('searchresults', array( 'FORUM_NAME' => $searchset[$i]['forum_name'], 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'FOLDER' => $images[$folder_img], 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_FOLDER_IMG' => $images[$folder_img], 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'TOPIC_TITLE' => $topic_title, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $views, 'TOPIC_AUTHOR' => $topic_author, 'FIRST_POST_TIME' => $first_post_time, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_IMG' => $last_post_url, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_FORUM' => $forum_url, 'U_VIEW_TOPIC' => $topic_url) ); } $base_url = $module_root_path . basename(__FILE__) . '?report_id=' . $report_id; $per_page = $board_config['topics_per_page']; $template->assign_vars(array( 'PAGINATION' => generate_pagination($base_url, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )), 'L_AUTHOR' => $lang['Author'], 'L_MESSAGE' => $lang['Message'], 'L_FORUM' => $lang['Forum'], 'L_TOPICS' => $lang['Topics'], 'L_REPLIES' => $lang['Replies'], 'L_VIEWS' => $lang['Views'], 'L_POSTS' => $lang['Posts'], 'L_LASTPOST' => $lang['Last_Post'], 'L_POSTED' => $lang['Posted'], 'L_SUBJECT' => $lang['Subject'], 'L_GOTO_PAGE' => $lang['Goto_page']) ); $template->pparse('view_topics'); // // Generate footer if running standalone... // if( $generate_headers ) { include_once($mx_root_path . 'includes/page_tail.'.$phpEx); } ?> --- NEW FILE: welcome.php --- <?php /*************************************************************************** * welcome.php * ----------- * begin : October, 2003 * Updated : April 2007 * copyright : Marc Ferran (c) 2003 * * module : mx_tinies * file contents : Welcome (Block). * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ //Some basic security if( !defined('IN_PORTAL')) { die('Hacking Attempt'); } // -------------------------------------------------------------------------------- // Block Initialization // -------------------------------------------------------------------------------- $block_title = 'Tinies: Welcome'; if( !function_exists('read_block_config') ) { message_die(GENERAL_ERROR, "This script should be executed as Portal Block.", 'mx_tinies'); } // // Include common module stuff... // include_once($module_root_path . 'includes/common.' . $phpEx); // // Read block Configuration // $block_config = read_block_config($block_id); $block_size = ( isset($block_size) && !empty($block_size) ? $block_size : '100%' ); $welcome_msg = $block_config[$block_id]['Tinies_Welcome_Msg']['parameter_value']; $register_msg = $block_config[$block_id]['Tinies_Register_Msg']['parameter_value']; $vertical_layout = ( $block_config[$block_id]['Tinies_Vertical_Layout']['parameter_value'] == 'TRUE' ? TRUE : FALSE ); $view_jump_to = ( $block_config[$block_id]['Tinies_View_JumpTo']['parameter_value'] == 'TRUE' ? TRUE : FALSE ); $default_avatar = $block_config[$block_id]['Tinies_Default_Avatar']['parameter_value']; $view_postcount = ( $block_config[$block_id]['Tinies_View_PostCount']['parameter_value'] == 'TRUE' ? TRUE : FALSE ); $report_page = intval($block_config[$block_id]['Tinies_Report_Page']['parameter_value']); define('IN_PORTAL', true); // -------------------------------------------------------------------------------- // Block Procedure // -------------------------------------------------------------------------------- // // Get User Avatar... // $avatar_img = ''; if( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] ) { switch( $userdata['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="'.PHPBB_URL.$board_config['avatar_path'].'/'.$userdata['user_avatar'].'" alt="" border="0" />' : ''; break; case USER_AVATAR_REMOTE: $img_width = ''; if( ($img_info = @getimagesize($userdata['user_avatar'])) !== FALSE ) { if( $img_info[0] > $board_config['avatar_max_width'] ) { $img_width = ' width="'.$board_config['avatar_max_width'].'"'; } } $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="'.$userdata['user_avatar'].'"'.$img_width.' alt="" border="0" />' : ''; break; case USER_AVATAR_GALLERY: $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="'.PHPBB_URL.$board_config['avatar_gallery_path'].'/'.$userdata['user_avatar'].'" alt="" border="0" />' : ''; break; } } if( empty($avatar_img) && !empty($default_avatar) ) { $avatar_img = '<img src="'.$module_root_path.'avatars/'.$default_avatar.'" alt="" border="0" />'; } // // This is the template used to render this block. // $template->set_filenames(array( 'welcome_body' => 'welcome_body.tpl') ); // // Activate template switches for Vertical/Horizontal Layout... // if( $vertical_layout ) { $template->assign_block_vars('welcome_vertical_layout', array()); } else { $template->assign_block_vars('welcome_horizontal_layout', array()); } // // Get User Dependent Information... // if( $userdata['session_logged_in'] ) { $s_last_visit = create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']); if( $view_postcount ) { $sql = 'SELECT t.topic_status, t.forum_id, t.topic_id, p2.post_time' . ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . POSTS_TABLE . ' p2' . ' WHERE p.post_id = t.topic_first_post_id' . ' AND p2.post_id = t.topic_last_post_id' . ' AND p2.post_time > ' . $userdata['user_lastvisit'] . ' AND t.forum_id IN (' . get_auth_forum() . ')'; if( ($result = $db->sql_query($sql)) == TRUE ) { $unread_posts = 0; $rowset = $db->sql_fetchrowset($result); $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); for( $i = 0; $i < count($rowset); $i++ ) { if( $rowset[$i]['topic_status'] == TOPIC_MOVED ) { continue; } if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { $topic_id = $rowset[$i]['topic_id']; if( !empty($tracking_topics[$topic_id]) ) { if( $tracking_topics[$topic_id] > $row['post_time'] ) { continue; } } $forum_id = $rowset[$i]['forum_id']; if( !empty($tracking_forums[$forum_id]) ) { if( $tracking_forums[$forum_id] > $rowset[$i]['post_time'] ) { continue; } } if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $rowset[$i]['post_time'] ) { continue; } } } $unread_posts++; } $s_search_new = $lang['Posts_since_last_visit'].' ('.count($rowset).')'; $s_search_unread = $lang['Search_unread'].' ('.$unread_posts.')'; } } $template->assign_block_vars('welcome_user_logged_in', array()); $template->assign_block_vars('welcome_user_admin_' . ($userdata['user_level'] == ADMIN ? 'on' : 'off'), array()); } else { $s_last_visit = ''; $register_msg = sprintf($register_msg, '<a href="'.append_sid(PHPBB_URL.'profile.'.$phpEx.'?mode=register').'">', '</a>'); $template->assign_block_vars('welcome_user_logged_out', array()); } $user_link = ( $userdata['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid(PHPBB_URL."profile.$phpEx?mode=editprofile&".$userdata['user_id']).'">'.$userdata['username'].'</a>' : $lang['Guest']; if( $report_page == 0 ) { $u_view_topics = $module_root_path.'view_topics.'.$phpEx.'?report_id='; } else { $u_view_topics = PORTAL_URL.'index.'.$phpEx.'?page='.$report_page.'&report_id='; } $u_unread = append_sid($u_view_topics.'unread'); $u_egostarted = append_sid($u_view_topics.'egostarted'); // // Setup common template vars and display the block. // $template->assign_vars(array( 'L_WELCOME' => $lang['Welcome'], 'L_WELCOME_USER' => sprintf($lang['Welcome_User'], $user_link), 'L_WELCOME_MSG' => ( empty($welcome_msg) ) ? '' : $welcome_msg.'<br /><br />', 'AVATAR_IMG' => $avatar_img, 'S_LOGIN_ACTION' => append_sid(PORTAL_URL.'login.'.$phpEx), 'L_USERNAME' => $lang['Username'], 'L_PASSWORD' => $lang['Password'], 'L_LOGIN' => $lang['Login'], 'L_LOG_ME_IN' => $lang['Log_me_in'], 'L_FORGOTTEN_PSW' => $lang['Forgotten_password'], 'U_FORGOTTEN_PSW' => append_sid(PHPBB_URL.'profile.'.$phpEx.'?mode=sendpassword'), 'L_REGISTER' => $lang['Register'], 'U_REGISTER' => append_sid(PHPBB_URL.'profile.'.$phpEx.'?mode=register'), 'L_REGISTER_MSG' => $register_msg, 'IMG_ICON_DOT' => PORTAL_URL.'modules/mx_tinies/templates/images/icon_dot.gif', 'L_SEARCH_NEW' => ( isset($s_search_new) ) ? $s_search_new : $lang['Posts_since_last_visit'], 'U_SEARCH_NEW' => append_sid(PHPBB_URL.'search.'.$phpEx.'?search_id=newposts'), 'L_SEARCH_UNREAD' => ( isset($s_search_unread) ) ? $s_search_unread : $lang['Search_unread'], 'U_SEARCH_UNREAD' => $u_unread, 'L_SEARCH_LATEST' => $lang['View_latest'], 'U_SEARCH_LATEST_24' => append_sid($u_view_topics.'24h'), 'U_SEARCH_LATEST_48' => append_sid($u_view_topics.'48h'), 'U_SEARCH_LATEST_72' => append_sid($u_view_topics.'72h'), 'L_SEARCH_SELF_TOPICS' => $lang['Search_self_topics'], 'U_SEARCH_SELF_TOPICS' => $u_egostarted, 'L_SEARCH_SELF_POSTS' => $lang['Search_self_posts'], 'U_SEARCH_SELF_POSTS' => append_sid(PHPBB_URL.'search.'.$phpEx.'?search_id=egosearch'), 'L_SEARCH_UNANSWERED' => $lang['Search_unanswered'], 'U_SEARCH_UNANSWERED' => append_sid(PHPBB_URL.'search.'.$phpEx.'?search_id=unanswered'), 'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'], 'U_MARK_READ' => append_sid(PHPBB_URL.'index.'.$phpEx . "?mark=forums"), 'L_PRIVATE_MSGS' => $lang['Private_Messages'].' ('.$userdata['user_new_privmsg'].')', 'U_PRIVATE_MSGS' => append_sid(PHPBB_URL.'privmsg.'.$phpEx.'?folder=inbox'), 'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit), 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])), 'S_TIMEZONE' => sprintf($lang['All_times'], $lang[number_format($board_config['board_timezone'])])) ); if( $view_jump_to ) { make_jumpbox(PHPBB_URL.'viewforum.'.$phpEx); } $template->pparse('welcome_body'); ?> |