|
From: Jon O. <jon...@us...> - 2005-04-12 19:37:25
|
Update of /cvsroot/mxbb/mx_calsnails/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8269/modules/mx_calsnails/includes Modified Files: cal_settings.php mx_common.php Log Message: renamed lang_calendar to lang_main and associated updates Index: cal_settings.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/includes/cal_settings.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cal_settings.php 6 Mar 2005 01:11:51 -0000 1.8 --- cal_settings.php 12 Apr 2005 19:37:11 -0000 1.9 *************** *** 1,39 **** ! <?php ! /** ! * MX-System changes to original source: ! * ! * MX001: See mx_calsnails/includes/mx_common.php for details. ! */ ! ! /** ! * Calendar Lite ! * note: following info added by CVS ! * original author: WebSnail < Martin Smallridge > ! * ! * $Author$ ! * $Date$ ! * $Revision$ ! */ ! ! /*############################################################### ! ## Mod Title: phpBB2 Calendar ! ## Mod Version: 1.4.1b ! ## Author: WebSnail < Martin Smallridge > ! ## SUPPORT: http://www.snailsource.com/forum/ ! ## Description: Variable settings for Calendar.php ! ## ! ## ! ## NOTE: Please read readme.txt ! ###############################################################*/ ! ! /*########################################## ! ## STOP # ! ## DO NOT MODIFY ANYTHING IN THIS FILE # ! ##########################################*/ ! ! $cal_version = "1.4.1c"; ! // MX001: $cal_lang_file = "lang_calendar.php"; ! // MX001: $tablename = 'calendar'; ! $mxbb_footer_addup[] = 'mxBB Calsnails Module'; ! ?> \ No newline at end of file --- 1,39 ---- ! <?php ! /** ! * MX-System changes to original source: ! * ! * MX001: See mx_calsnails/includes/mx_common.php for details. ! */ ! ! /** ! * Calendar Lite ! * note: following info added by CVS ! * original author: WebSnail < Martin Smallridge > ! * ! * $Author$ ! * $Date$ ! * $Revision$ ! */ ! ! /*############################################################### ! ## Mod Title: phpBB2 Calendar ! ## Mod Version: 1.4.1b ! ## Author: WebSnail < Martin Smallridge > ! ## SUPPORT: http://www.snailsource.com/forum/ ! ## Description: Variable settings for Calendar.php ! ## ! ## ! ## NOTE: Please read readme.txt ! ###############################################################*/ ! ! /*########################################## ! ## STOP # ! ## DO NOT MODIFY ANYTHING IN THIS FILE # ! ##########################################*/ ! ! $cal_version = "1.4.1c"; ! // MX001: $cal_lang_file = "lang_main.php"; ! // MX001: $tablename = 'calendar'; ! $mxbb_footer_addup[] = 'mxBB Calsnails Module'; ! ?> \ No newline at end of file Index: mx_common.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/includes/mx_common.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mx_common.php 9 Jan 2005 21:31:28 -0000 1.5 --- mx_common.php 12 Apr 2005 19:37:11 -0000 1.6 *************** *** 1,185 **** ! <?php ! /** ! * mx_common.php ! * ------------- ! * begin : May, 2003 ! * copyright : (C) 2002-2003 MX-System ! * email : su...@mx... ! * ! * module version : v 1.05 2003/07/05 by markus_petrux ! * ! * $Id$ ! */ ! ! /** ! * 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. ! */ ! ! // Include common scripts. ! ! include_once( $module_root_path . 'includes/cal_settings.' . $phpEx ); ! ! // Load language files. ! ! if ( file_exists( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_calendar.' . $phpEx ) ) ! { ! include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_calendar.' . $phpEx ); ! } ! else ! { ! include( $module_root_path . 'language/lang_english/lang_calendar.' . $phpEx ); ! } ! ! // Define table names. ! ! define( 'CALLITE_CONFIG_TABLE', $mx_table_prefix . 'callite_config' ); ! define( 'CALLITE_EVENTS_TABLE', $mx_table_prefix . 'callite_events' ); ! ! if ( !defined( 'DB_INSTALL' ) ) ! { ! ! // Get Calendar Settings from Cal_config table ! ! $cal_config = array(); ! ! $sql = "SELECT * FROM " . CALLITE_CONFIG_TABLE; ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! 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']; ! } ! } ! $cal_dateformat = !empty( $cal_config['cal_dateformat'] ) ? $cal_config['cal_dateformat'] : $board_config['default_dateformat']; ! // Timezone off 1 day fix ! // $cal_timezone = $board_config['board_timezone']; ! $userdata['calsnails_timezone'] = 0; ! } ! ! // Prepare some other common variables ! ! define( 'SECONDS_PER_DAY', 86400 ); // 24h * 60m * 60s ! ! // -------------------------------------------------------------------------------- ! // [ FUNCTIONS ] ! // -------------------------------------------------------------------------------- ! ! // my_dateformat comes from calendar.php, so it can be reused. ! // Also, we try to solve 2 bugs in one step: ! // a) Martin's mydateformat() does not translate weekdays. ! // b) Solve the phpBB collision with $lang['datetime']['May']. ! ! function my_dateformat( $thisdate, $dateformat = 'd M Y G:i', $span = 0 ) ! { ! global $cal_dateformat, $cal_timezone, $userdata; ! // date comes in as the following: ! $myr = substr( $thisdate, 0, 4 ); ! $mym = substr( $thisdate, 5, 2 ); ! $myd = substr( $thisdate, 8, 2 ); ! $myh = substr( $thisdate, 11, 2 ); ! $myn = substr( $thisdate, 14, 2 ); ! $mys = substr( $thisdate, 17, 2 ); ! ! if ( $span || ( $myh == '00' && $myn == '00' && $mys == '00' ) ) ! { ! // Need to strip out any TIME references so... ! $timerefs = array ( 'a', 'A', 'B', 'g', 'G', 'h', 'H', 'i', 'I', 's' ); ! while ( list( , $val ) = each ( $timerefs ) ) ! { ! $dateformat = ereg_replace( $val, "", $dateformat ); ! } ! // strip out any characters used for time ! $dateformat = ereg_replace( '[:\.]', " ", $dateformat ); ! } ! ! // Ok, this is problem (a). No translation occurs :( ! ! // $returndate = gmdate($dateformat, gmmktime ($myh,$myn,$mys,$mym,$myd,$myr)); ! // Fix for time off 1 day ! // $returndate = my_create_date($dateformat, gmmktime ($myh,$myn,$mys,$mym,$myd,$myr), $cal_timezone); ! $returndate = my_create_date( $dateformat, gmmktime( $myh, $myn, $mys, $mym, $myd, $myr ), $userdata['calsnails_timezone'] ); ! return $returndate; ! } ! ! // This is about problem (b). Using our own version of phpbb.functions_php.create_date() ! // we can use our own copy of $lang['datetime']['May'] (see lang_calendar.php files). ! ! function my_create_date( $format, $gmepoch, $tz ) ! { ! global $board_config, $lang; ! static $translate; ! ! if ( empty( $translate ) && $board_config['default_lang'] != 'english' ) ! { ! @reset( $lang['datetime'] ); ! while ( list( $match, $replace ) = @each( $lang['datetime'] ) ) ! { ! $translate[$match] = $replace; ! } ! } ! ! return ( !empty( $translate ) ) ? strtr( @gmdate( $format, $gmepoch + ( 3600 * $tz ) ), $translate ) : @gmdate( $format, $gmepoch + ( 3600 * $tz ) ); ! } ! ! // The easiest way I found to decode BBText. ! ! function my_decode_bbtext( $bbtext, $bbcode_uid ) ! { ! global $board_config; ! ! $mytext = stripslashes( $bbtext ); ! if ( $board_config['allow_bbcode'] ) ! { ! $mytext = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $mytext, $bbcode_uid ) : preg_replace( "/\:[0-9a-z\:]+\]/si", "]", $mytext ); ! } ! if ( $board_config['allow_smilies'] ) ! { ! $smilies_path = $board_config['smilies_path']; ! $board_config['smilies_path'] = PHPBB_URL . $board_config['smilies_path']; ! $mytext = smilies_pass( $mytext ); ! $board_config['smilies_path'] = $smilies_path; ! } ! return $mytext; ! } ! ! // Truncate words on a string to specified length and append '...' if necesary. ! ! function my_truncate_words( $text, $length ) ! { ! $mytext = stripslashes( $text ); ! if ( strlen( $mytext ) > $length ) ! { ! $mytext = substr( $mytext, 0, $length ); ! $mytext = substr( $mytext, 0, strrpos( $mytext, ' ' ) ); ! $mytext .= '...'; ! } ! return $mytext; ! } ! // Get week number of year ! function week_of_year( $day, $month, $year ) ! { ! global $cal_config; ! ! $timestamp = gmmktime( 0, 0, 0, $month, $day, $year ); ! $date = getdate( $timestamp ); ! $woy = gmdate( 'W', $timestamp ); ! ! if ( $cal_config['week_start'] != 1 ) ! { ! if ( $date['wday'] == 0 ) ! { ! $woy++; ! } ! } ! ! return $woy; ! } ! ?> \ No newline at end of file --- 1,185 ---- ! <?php ! /** ! * mx_common.php ! * ------------- ! * begin : May, 2003 ! * copyright : (C) 2002-2003 MX-System ! * email : su...@mx... ! * ! * module version : v 1.05 2003/07/05 by markus_petrux ! * ! * $Id$ ! */ ! ! /** ! * 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. ! */ ! ! // Include common scripts. ! ! include_once( $module_root_path . 'includes/cal_settings.' . $phpEx ); ! ! // Load language files. ! ! if ( file_exists( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ) ) ! { ! include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); ! } ! else ! { ! include( $module_root_path . 'language/lang_english/lang_main.' . $phpEx ); ! } ! ! // Define table names. ! ! define( 'CALLITE_CONFIG_TABLE', $mx_table_prefix . 'callite_config' ); ! define( 'CALLITE_EVENTS_TABLE', $mx_table_prefix . 'callite_events' ); ! ! if ( !defined( 'DB_INSTALL' ) ) ! { ! ! // Get Calendar Settings from Cal_config table ! ! $cal_config = array(); ! ! $sql = "SELECT * FROM " . CALLITE_CONFIG_TABLE; ! if ( !( $result = $db->sql_query( $sql ) ) ) ! { ! 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']; ! } ! } ! $cal_dateformat = !empty( $cal_config['cal_dateformat'] ) ? $cal_config['cal_dateformat'] : $board_config['default_dateformat']; ! // Timezone off 1 day fix ! // $cal_timezone = $board_config['board_timezone']; ! $userdata['calsnails_timezone'] = 0; ! } ! ! // Prepare some other common variables ! ! define( 'SECONDS_PER_DAY', 86400 ); // 24h * 60m * 60s ! ! // -------------------------------------------------------------------------------- ! // [ FUNCTIONS ] ! // -------------------------------------------------------------------------------- ! ! // my_dateformat comes from calendar.php, so it can be reused. ! // Also, we try to solve 2 bugs in one step: ! // a) Martin's mydateformat() does not translate weekdays. ! // b) Solve the phpBB collision with $lang['datetime']['May']. ! ! function my_dateformat( $thisdate, $dateformat = 'd M Y G:i', $span = 0 ) ! { ! global $cal_dateformat, $cal_timezone, $userdata; ! // date comes in as the following: ! $myr = substr( $thisdate, 0, 4 ); ! $mym = substr( $thisdate, 5, 2 ); ! $myd = substr( $thisdate, 8, 2 ); ! $myh = substr( $thisdate, 11, 2 ); ! $myn = substr( $thisdate, 14, 2 ); ! $mys = substr( $thisdate, 17, 2 ); ! ! if ( $span || ( $myh == '00' && $myn == '00' && $mys == '00' ) ) ! { ! // Need to strip out any TIME references so... ! $timerefs = array ( 'a', 'A', 'B', 'g', 'G', 'h', 'H', 'i', 'I', 's' ); ! while ( list( , $val ) = each ( $timerefs ) ) ! { ! $dateformat = ereg_replace( $val, "", $dateformat ); ! } ! // strip out any characters used for time ! $dateformat = ereg_replace( '[:\.]', " ", $dateformat ); ! } ! ! // Ok, this is problem (a). No translation occurs :( ! ! // $returndate = gmdate($dateformat, gmmktime ($myh,$myn,$mys,$mym,$myd,$myr)); ! // Fix for time off 1 day ! // $returndate = my_create_date($dateformat, gmmktime ($myh,$myn,$mys,$mym,$myd,$myr), $cal_timezone); ! $returndate = my_create_date( $dateformat, gmmktime( $myh, $myn, $mys, $mym, $myd, $myr ), $userdata['calsnails_timezone'] ); ! return $returndate; ! } ! ! // This is about problem (b). Using our own version of phpbb.functions_php.create_date() ! // we can use our own copy of $lang['datetime']['May'] (see lang_main.php files). ! ! function my_create_date( $format, $gmepoch, $tz ) ! { ! global $board_config, $lang; ! static $translate; ! ! if ( empty( $translate ) && $board_config['default_lang'] != 'english' ) ! { ! @reset( $lang['datetime'] ); ! while ( list( $match, $replace ) = @each( $lang['datetime'] ) ) ! { ! $translate[$match] = $replace; ! } ! } ! ! return ( !empty( $translate ) ) ? strtr( @gmdate( $format, $gmepoch + ( 3600 * $tz ) ), $translate ) : @gmdate( $format, $gmepoch + ( 3600 * $tz ) ); ! } ! ! // The easiest way I found to decode BBText. ! ! function my_decode_bbtext( $bbtext, $bbcode_uid ) ! { ! global $board_config; ! ! $mytext = stripslashes( $bbtext ); ! if ( $board_config['allow_bbcode'] ) ! { ! $mytext = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass( $mytext, $bbcode_uid ) : preg_replace( "/\:[0-9a-z\:]+\]/si", "]", $mytext ); ! } ! if ( $board_config['allow_smilies'] ) ! { ! $smilies_path = $board_config['smilies_path']; ! $board_config['smilies_path'] = PHPBB_URL . $board_config['smilies_path']; ! $mytext = smilies_pass( $mytext ); ! $board_config['smilies_path'] = $smilies_path; ! } ! return $mytext; ! } ! ! // Truncate words on a string to specified length and append '...' if necesary. ! ! function my_truncate_words( $text, $length ) ! { ! $mytext = stripslashes( $text ); ! if ( strlen( $mytext ) > $length ) ! { ! $mytext = substr( $mytext, 0, $length ); ! $mytext = substr( $mytext, 0, strrpos( $mytext, ' ' ) ); ! $mytext .= '...'; ! } ! return $mytext; ! } ! // Get week number of year ! function week_of_year( $day, $month, $year ) ! { ! global $cal_config; ! ! $timestamp = gmmktime( 0, 0, 0, $month, $day, $year ); ! $date = getdate( $timestamp ); ! $woy = gmdate( 'W', $timestamp ); ! ! if ( $cal_config['week_start'] != 1 ) ! { ! if ( $date['wday'] == 0 ) ! { ! $woy++; ! } ! } ! ! return $woy; ! } ! ?> \ No newline at end of file |