Update of /cvsroot/mxbb/mx_calsnails In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4127/modules/mx_calsnails Modified Files: calendar.php db_install.php db_uninstall.php db_upgrade.php mx_calendar_events.php mx_calendar_query.php Log Message: Code cleanup Index: mx_calendar_query.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/mx_calendar_query.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mx_calendar_query.php 17 Jun 2006 20:45:55 -0000 1.13 --- mx_calendar_query.php 29 Jun 2006 13:39:03 -0000 1.14 *************** *** 35,40 **** } // Security Check ! if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { --- 35,41 ---- } + // // Security Check ! // if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { *************** *** 49,52 **** --- 50,54 ---- $caluser = ( $userdata['user_id'] == ANONYMOUS ? $cal_config['allow_anon'] : $cal_config['allow_user_default'] ); } + // -------------------------------------------------------------------------------- // Check if the user can see. Otherwise, nothing to do. *************** *** 55,60 **** { // -------------------------------------------------------------------------------- ! $template->set_filenames( array( 'body' => 'mx_calendar_query.tpl' ) ! ); $sql = "SELECT * FROM " . CALLITE_EVENTS_TABLE . " WHERE valid = 'yes'"; --- 57,61 ---- { // -------------------------------------------------------------------------------- ! $template->set_filenames( array( 'body' => 'mx_calendar_query.tpl' ) ); $sql = "SELECT * FROM " . CALLITE_EVENTS_TABLE . " WHERE valid = 'yes'"; *************** *** 71,74 **** --- 72,76 ---- mx_message_die( GENERAL_ERROR, 'Could not select Event data', '', __LINE__, __FILE__, $sql ); } + $check = 0; while ( $row = $db->sql_fetchrow( $result ) ) *************** *** 76,98 **** if ( $check == 0 ) { ! $template->assign_block_vars( 'event_row', array( 'ROW_CLASS' => 'catHead', ! 'EVENT_ID' => '<b>ID</b>', ! 'SUBJECT' => '<b>SUBJECT</b>', ! 'DATE' => '<b>STAMP</b>', ! 'END_DATE' => '<b>EVENTSPAN</b>', ! 'DESC' => '<b>DESCRIPTION</b>', ! 'BBTEXT' => '', ! 'AUTHOR' => '<b>USERNAME</b>' ) ! ); ! } ! $template->assign_block_vars( 'event_row', array( 'ROW_CLASS' => ( $check % 2 == 0 ) ? 'row1' : 'row2', ! 'EVENT_ID' => stripslashes( $row['event_id'] ), ! 'SUBJECT' => stripslashes( $row['subject'] ), ! 'DATE' => my_dateformat( $row['stamp'], $block_datefmt ), ! 'END_DATE' => my_dateformat( $row['eventspan'], $block_datefmt, 1 ), ! 'DESC' => stripslashes( $row['description'] ), ! 'BBTEXT' => my_decode_bbtext( $row['description'], $row['bbcode_uid'] ), ! 'AUTHOR' => stripslashes( $row['username'] ) ) ); $check++; } --- 78,103 ---- if ( $check == 0 ) { ! $template->assign_block_vars( 'event_row', array( ! 'ROW_CLASS' => 'catHead', ! 'EVENT_ID' => '<b>ID</b>', ! 'SUBJECT' => '<b>SUBJECT</b>', ! 'DATE' => '<b>STAMP</b>', ! 'END_DATE' => '<b>EVENTSPAN</b>', ! 'DESC' => '<b>DESCRIPTION</b>', ! 'BBTEXT' => '', ! 'AUTHOR' => '<b>USERNAME</b>' ) ); + } + + $template->assign_block_vars( 'event_row', array( + 'ROW_CLASS' => ( $check % 2 == 0 ) ? 'row1' : 'row2', + 'EVENT_ID' => stripslashes( $row['event_id'] ), + 'SUBJECT' => stripslashes( $row['subject'] ), + 'DATE' => my_dateformat( $row['stamp'], $block_datefmt ), + 'END_DATE' => my_dateformat( $row['eventspan'], $block_datefmt, 1 ), + 'DESC' => stripslashes( $row['description'] ), + 'BBTEXT' => my_decode_bbtext( $row['description'], $row['bbcode_uid'] ), + 'AUTHOR' => stripslashes( $row['username'] ) ) + ); $check++; } *************** *** 103,115 **** $template->assign_block_vars( 'no_events', array( 'NO_EVENTS' => $lang["No events"] ) ); } ! $template->assign_vars( array( 'BLOCK_SIZE' => $block_size, ! 'L_TITLE' => ( $block_title == '' ? $lang['Calendar_Events'] : $block_title ) ) ! ); $template->pparse( 'body' ); // -------------------------------------------------------------------------------- ! } //if( $caluser > 0 ) // -------------------------------------------------------------------------------- ! unset( $caluser ); //MX001: added so more than one block per page may exist. ! ! ?> \ No newline at end of file --- 108,120 ---- $template->assign_block_vars( 'no_events', array( 'NO_EVENTS' => $lang["No events"] ) ); } ! $template->assign_vars( array( ! 'BLOCK_SIZE' => $block_size, ! 'L_TITLE' => ( $block_title == '' ? $lang['Calendar_Events'] : $block_title ) ) ! ); ! $template->pparse( 'body' ); // -------------------------------------------------------------------------------- ! } // // -------------------------------------------------------------------------------- ! unset( $caluser ); ?> \ No newline at end of file Index: db_uninstall.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/db_uninstall.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** db_uninstall.php 2 May 2006 23:25:58 -0000 1.12 --- db_uninstall.php 29 Jun 2006 13:39:03 -0000 1.13 *************** *** 30,38 **** } ! $sql = array( "DROP TABLE " . $mx_table_prefix . "callite_config ", ! "DROP TABLE " . $mx_table_prefix . "callite_events" ! ! ); echo "<br /><br />"; --- 30,37 ---- } ! $sql = array( ! "DROP TABLE " . $mx_table_prefix . "callite_config ", "DROP TABLE " . $mx_table_prefix . "callite_events" ! ); echo "<br /><br />"; *************** *** 41,44 **** echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . mx_do_install_upgrade( $sql ) . "</span></td></tr>"; echo "</table><br />"; - ?> \ No newline at end of file --- 40,42 ---- Index: db_upgrade.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/db_upgrade.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** db_upgrade.php 2 May 2006 23:25:58 -0000 1.13 --- db_upgrade.php 29 Jun 2006 13:39:03 -0000 1.14 *************** *** 30,34 **** } ! $mx_module_version = '2.0.0'; $mx_module_copy = 'Original phpBB <i>Calendar LITE</i> MOD by <a href="http://www.snailsource.com/" target="_blank">Martin</a> :: Adapted for mxBB by <a href="http://www.phpmix.com" target="_blank">Markus</a> & <a href="http://www.mxbb-portal.com" target="_blank">Jon</a>'; --- 30,34 ---- } ! $mx_module_version = '2.8.0'; $mx_module_copy = 'Original phpBB <i>Calendar LITE</i> MOD by <a href="http://www.snailsource.com/" target="_blank">Martin</a> :: Adapted for mxBB by <a href="http://www.phpmix.com" target="_blank">Markus</a> & <a href="http://www.mxbb-portal.com" target="_blank">Jon</a>'; Index: db_install.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/db_install.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** db_install.php 2 May 2006 23:25:58 -0000 1.20 --- db_install.php 29 Jun 2006 13:39:03 -0000 1.21 *************** *** 30,34 **** } ! $mx_module_version = '2.0.0'; $mx_module_copy = 'Original phpBB <i>Calendar LITE</i> MOD by <a href="http://www.snailsource.com/" target="_blank">Martin</a> :: Adapted for mxBB by <a href="http://www.phpmix.com" target="_blank">Markus</a> & <a href="http://www.mxbb-portal.com" target="_blank">Jon</a>'; --- 30,34 ---- } ! $mx_module_version = '2.8.0'; $mx_module_copy = 'Original phpBB <i>Calendar LITE</i> MOD by <a href="http://www.snailsource.com/" target="_blank">Martin</a> :: Adapted for mxBB by <a href="http://www.phpmix.com" target="_blank">Markus</a> & <a href="http://www.mxbb-portal.com" target="_blank">Jon</a>'; Index: mx_calendar_events.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/mx_calendar_events.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mx_calendar_events.php 17 Jun 2006 20:45:55 -0000 1.19 --- mx_calendar_events.php 29 Jun 2006 13:39:03 -0000 1.20 *************** *** 44,49 **** define( 'CALRANGE_NEXT_MONTH', 'next month' ); // Check parameters: assign default values if the module is not correctly installed. ! if ( empty( $block_title ) ) { --- 44,50 ---- define( 'CALRANGE_NEXT_MONTH', 'next month' ); + // // Check parameters: assign default values if the module is not correctly installed. ! // if ( empty( $block_title ) ) { *************** *** 67,71 **** --- 68,74 ---- } + // // Get Calsnails target block + // $cal_block_id = $mx_block->get_parameters( 'target_block' ); $cal_page_id = get_page_id( $cal_block_id ); *************** *** 74,79 **** $cal_page_filter = $cal_block_config[$cal_block_id]['cal_filter']['parameter_value'] == 'TRUE'; // Security Check ! if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { --- 77,83 ---- $cal_page_filter = $cal_block_config[$cal_block_id]['cal_filter']['parameter_value'] == 'TRUE'; + // // Security Check ! // if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { *************** *** 88,91 **** --- 92,96 ---- $caluser = ( $userdata['user_id'] == ANONYMOUS ? $cal_config['allow_anon'] : $cal_config['allow_user_default'] ); } + // -------------------------------------------------------------------------------- // Check if the user can see. Otherwise, nothing to do. *************** *** 97,101 **** // Compute date range depending on block parameters. - switch ( $events_range ) { --- 102,105 ---- *************** *** 139,144 **** list( $end_yy, $end_mm, $end_dd ) = explode( '-', create_date( 'Y-m-j', $end_time, $cal_timezone ) ); // Build the query (note use of fixed condition: valid = 'yes'). ! $sql = "SELECT * FROM " . CALLITE_EVENTS_TABLE . " WHERE valid = 'yes' AND "; --- 143,149 ---- list( $end_yy, $end_mm, $end_dd ) = explode( '-', create_date( 'Y-m-j', $end_time, $cal_timezone ) ); + // // Build the query (note use of fixed condition: valid = 'yes'). ! // $sql = "SELECT * FROM " . CALLITE_EVENTS_TABLE . " WHERE valid = 'yes' AND "; *************** *** 156,161 **** } // Loop through Calendar Events... ! $today = create_date( 'Y-m-d', time(), $cal_timezone ); $check = 0; --- 161,167 ---- } + // // Loop through Calendar Events... ! // $today = create_date( 'Y-m-d', time(), $cal_timezone ); $check = 0; *************** *** 215,220 **** $db->sql_freeresult($result); // Do we get any event? Do we need to enable scrollbars? ! if ( $check == 0 ) { --- 221,227 ---- $db->sql_freeresult($result); + // // Do we get any event? Do we need to enable scrollbars? ! // if ( $check == 0 ) { *************** *** 266,271 **** } // Setup common template vars and display the block. ! $template->assign_vars( array( 'BLOCK_SIZE' => $block_size, 'EVENTS_LABEL' => $events_label, --- 273,279 ---- } + // // Setup common template vars and display the block. ! // $template->assign_vars( array( 'BLOCK_SIZE' => $block_size, 'EVENTS_LABEL' => $events_label, *************** *** 278,285 **** $template->pparse( 'body' ); // -------------------------------------------------------------------------------- ! } //if( $caluser > 0 ) // -------------------------------------------------------------------------------- ! unset( $caluser ); //MX001: added so more than one block per page may exist. ! ! ?> \ No newline at end of file --- 286,291 ---- $template->pparse( 'body' ); // -------------------------------------------------------------------------------- ! } // // -------------------------------------------------------------------------------- ! unset( $caluser ); ?> \ No newline at end of file Index: calendar.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/calendar.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** calendar.php 29 May 2006 15:38:05 -0000 1.25 --- calendar.php 29 Jun 2006 13:39:03 -0000 1.26 *************** *** 37,41 **** #################################################################*/ // -------------------------------------------------- - // +MX001: Begin if( !defined('IN_PORTAL') || !is_object($mx_block)) --- 37,40 ---- *************** *** 44,49 **** } // Common Includes and Read Calendar Lite Settings ! include_once( $module_root_path . 'includes/mx_common.' . $phpEx ); --- 43,49 ---- } + // // Common Includes and Read Calendar Lite Settings ! // include_once( $module_root_path . 'includes/mx_common.' . $phpEx ); *************** *** 59,65 **** $cal_filter = $mx_block->get_parameters( 'cal_filter' ) == 'TRUE' ; $cal_mod_group = $mx_block->get_parameters( 'cal_mod_group' ); - // echo($cal_auth_all.$cal_auth_reg.$cal_filter); // Get Calsnails target block $cal_block_id = $mx_block->get_parameters( 'target_block' ); $cal_page_id = get_page_id( $cal_block_id ); --- 59,66 ---- $cal_filter = $mx_block->get_parameters( 'cal_filter' ) == 'TRUE' ; $cal_mod_group = $mx_block->get_parameters( 'cal_mod_group' ); + // // Get Calsnails target block + // $cal_block_id = $mx_block->get_parameters( 'target_block' ); $cal_page_id = get_page_id( $cal_block_id ); *************** *** 70,100 **** } // Get the current MX page. ! $page_id = ( !empty( $HTTP_POST_VARS['page'] ) ) ? $HTTP_POST_VARS['page'] : $HTTP_GET_VARS['page']; - // -MX001: End - // -------------------------------------------------- - // Set $phpbb_root_path to location of phpBB2 root directory. - // MX002: $phpbb_root_path = "./"; - // MX002: include_once($phpbb_root_path . 'cal_settings.php'); /*########################################## ## STOP # ## DO NOT MODIFY ANYTHING BELOW THIS LINE # ##########################################*/ // Security Check if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { // Failed the test... Someone tried to spoof as a user. ! die( "Hacking attempt" ); //MX001: added ! } ! // +MX001 ! /* ! else { ! // Passed. ! define('IN_PHPBB', true); } ! */ ! // -MX001 $params = array( 'sid' => 'sid', 'id' => 'id', --- 71,93 ---- } + // // Get the current MX page. ! // $page_id = ( !empty( $HTTP_POST_VARS['page'] ) ) ? $HTTP_POST_VARS['page'] : $HTTP_GET_VARS['page']; /*########################################## ## STOP # ## DO NOT MODIFY ANYTHING BELOW THIS LINE # ##########################################*/ + + // // Security Check + // if ( isset( $HTTP_GET_VARS['caluser'] ) || isset( $HTTP_POST_VARS['caluser'] ) || isset( $caluser ) ) { // Failed the test... Someone tried to spoof as a user. ! die( "Hacking attempt" ); } ! $params = array( 'sid' => 'sid', 'id' => 'id', *************** *** 126,169 **** } } ! // unset($HTTP_POST_VARS); ! // unset($HTTP_GET_VARS); ! // MX004: $thisscript = basename(__FILE__); $thisscript = $module_root_path . basename( __FILE__ ); - // connect to phpbb - // +MX003 - // include_once($phpbb_root_path . 'extension.inc'); - // include_once($phpbb_root_path . 'common.'.$phpEx); - // include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); - // include_once($phpbb_root_path . 'includes/functions.'.$phpEx); - // -MX003 - // Start session management - // MX001: $userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length); - // MX001: init_userprefs($userdata); - // +MX006 - // define('CAL_TABLE', ($table_prefix . $tablename)); - // define('CAL_CONFIG', ($table_prefix . cal_config)); - // -MX006 - // -------------------------------------------------- - // +MX016 - /* - // Get Calendar Settings from Cal_config table - $cal_config = array(); - $sql = "SELECT * FROM ".CAL_CONFIG; - if(!$result = $db->sql_query($sql)) - { - mx_message_die(GENERAL_ERROR, "Couldn't query calendar config table", "", __LINE__, __FILE__, $sql); - } - else - { - while( $row = $db->sql_fetchrow($result) ) - { - $cal_config[$row['config_name']] = $row['config_value']; - } - } - $db->sql_freeresult($result); - // End of Calendar settings - */ - // -MX016 // -------------------------------------------------- // Interim days id to help with transfer to $lang['datetime'] format. --- 119,125 ---- } } ! $thisscript = $module_root_path . basename( __FILE__ ); // -------------------------------------------------- // Interim days id to help with transfer to $lang['datetime'] format. *************** *** 177,181 **** $langdays[6] = $lang['datetime']['Saturday']; $langdays[7] = $lang['datetime']['Sunday']; // Repeated to cover a Monday start ! // +MX014 if ( $cal_mode_mini ) { --- 133,137 ---- $langdays[6] = $lang['datetime']['Saturday']; $langdays[7] = $lang['datetime']['Sunday']; // Repeated to cover a Monday start ! if ( $cal_mode_mini ) { *************** *** 189,198 **** $langdays[7] = $langdays[0]; } ! // -MX014 // Add EDIT block nav // $is_auth_ary = array(); $is_cal_moderator = !$cal_mode_mini ? mx_is_group_member( $cal_mod_group ) : false; // Set Users permissions. if ( $userdata['user_level'] == ADMIN || $is_cal_moderator ) { --- 145,158 ---- $langdays[7] = $langdays[0]; } ! ! // // Add EDIT block nav // $is_auth_ary = array(); + // $is_cal_moderator = !$cal_mode_mini ? mx_is_group_member( $cal_mod_group ) : false; + // // Set Users permissions. + // if ( $userdata['user_level'] == ADMIN || $is_cal_moderator ) { *************** *** 201,209 **** else { - // MX999: $test = $userdata['user_id']; - // MX999: $caluser = calendarperm($test); // Set the user level for the user. - // +MX015 - // $caluser = ($userdata['user_id'] == '-1' ? $cal_config['allow_anon'] : $cal_config['allow_user_default']); - // -MX015 $caluser = ( $userdata['user_id'] == '-1' ? $cal_auth_all : $cal_auth_reg ); } --- 161,164 ---- *************** *** 217,227 **** $lvd = "Not Logged In"; } ! // +MX005 if ( $generate_headers ) { include( $mx_root_path . 'includes/page_header.' . $phpEx ); } ! // -MX005 // Set Calendar Home URL (used in all templates) $homeurl = append_sid( this_mxurl() ); --- 172,184 ---- $lvd = "Not Logged In"; } ! if ( $generate_headers ) { include( $mx_root_path . 'includes/page_header.' . $phpEx ); } ! ! // // Set Calendar Home URL (used in all templates) + // $homeurl = append_sid( this_mxurl() ); *************** *** 245,249 **** } // -------------------------------------------------- - // +MX015 // Public Access check --- 202,205 ---- *************** *** 254,259 **** // } - // MX015: Avoid sending an auth error for MINI mode. - if ( !$cal_mode_mini ) { --- 210,213 ---- *************** *** 273,277 **** } - // -MX015 // -------------------------------------------------- // Default date --- 227,230 ---- *************** *** 288,291 **** --- 241,245 ---- } */ + // FIX: Time off 1 day if ( !$day ) *************** *** 307,311 **** $lastday++; } ! // +MX014 if ( $cal_mode_mini ) { --- 261,265 ---- $lastday++; } ! if ( $cal_mode_mini ) { *************** *** 324,328 **** { display(); ! } //MX015: added $caluser condition elseif ( $action == 'Delete_marked' && $caluser >= 4 ) { --- 278,282 ---- { display(); ! } elseif ( $action == 'Delete_marked' && $caluser >= 4 ) { *************** *** 340,349 **** { defaultview( $todaycolor ); ! } //MX015: added $caluser condition } - // -MX014 - unset( $caluser ); //MX001: added so more than one block per page may exist. ! // +MX005 if ( $generate_headers ) { --- 294,302 ---- { defaultview( $todaycolor ); ! } } ! unset( $caluser ); ! if ( $generate_headers ) { *************** *** 351,360 **** exit; } ! // -MX005 // ------------------------------------------------------------------------------------------ // [ FUNCTIONS ] // ------------------------------------------------------------------------------------------ // -------------------------------------------------- - // +MX021: Begin if ( function_exists( 'this_mxurl' ) ) --- 304,312 ---- exit; } ! // ------------------------------------------------------------------------------------------ // [ FUNCTIONS ] // ------------------------------------------------------------------------------------------ // -------------------------------------------------- if ( function_exists( 'this_mxurl' ) ) *************** *** 363,370 **** } - // -MX021: End // -------------------------------------------------- // -------------------------------------------------- - // +MX007: Begin - ?> \ No newline at end of file --- 315,319 ---- |