summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-10-29 17:53:55 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-10-29 17:53:55 +0000
commit639c6d997e1554242606c92131c3706b670407d3 (patch)
tree03c6d8d99ad5c13dc5d65f0fd1b58628792c1226
parenta19739c746b3e1ee611000baaaad60026b4e78a9 (diff)
downloadkernel-639c6d997e1554242606c92131c3706b670407d3.tar.gz
kernel-639c6d997e1554242606c92131c3706b670407d3.tar.bz2
kernel-639c6d997e1554242606c92131c3706b670407d3.zip
merge recent changes into HEAD
-rw-r--r--BitDate.php342
-rwxr-xr-xBitSystem.php148
-rw-r--r--admin/schema_inc.php242
-rwxr-xr-xbit_error_inc.php2
-rw-r--r--config_defaults_inc.php1
-rw-r--r--setup_inc.php16
-rw-r--r--smarty_bit/block.jstab.php4
-rw-r--r--smarty_bit/block.jstabs.php20
-rw-r--r--smarty_bit/function.formhelp.php2
-rw-r--r--templates/admin_banning.tpl2
-rw-r--r--templates/admin_custom_modules.tpl4
-rw-r--r--templates/admin_layout.tpl13
-rw-r--r--templates/admin_menus.tpl6
-rw-r--r--templates/admin_server.tpl4
-rw-r--r--templates/dynamic.tpl8
-rw-r--r--templates/error.tpl4
-rw-r--r--templates/header.tpl8
17 files changed, 485 insertions, 341 deletions
diff --git a/BitDate.php b/BitDate.php
index f60ea8f..2e8388f 100644
--- a/BitDate.php
+++ b/BitDate.php
@@ -3,7 +3,7 @@
* Date Handling Class
*
* @package kernel
- * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitDate.php,v 1.6 2005/10/12 15:13:51 spiderr Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitDate.php,v 1.7 2005/10/29 17:53:54 squareing Exp $
*
* Created by: Jeremy Jongsma (jjongsma@tickchat.com)
* Created on: Sat Jul 26 11:51:31 CDT 2003
@@ -149,37 +149,37 @@ class BitDate {
function getTimestampFromISO($iso_date) {
$ret = 0;
if ( is_numeric($iso_date) ) $ret = $iso_date;
- else if (preg_match(
- "|^([0-9]{3,4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|",
+ else if (preg_match(
+ "|^([0-9]{3,4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|",
($iso_date), $rr)) {
// h-m-s-MM-DD-YY
if (!isset($rr[5])) $ret = $this->mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
else $ret = @$this->mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]);
}
- return $ret;
+ return $ret;
}
/**
- * Returns day of week, 0 = Sunday,... 6=Saturday.
+ * Returns day of week, 0 = Sunday,... 6=Saturday.
* Algorithm from PEAR::Date_Calc
*/
function dayOfWeek($year, $month, $day)
{
/*
- Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and
- proclaimed that from that time onwards 3 days would be dropped from the calendar
+ Pope Gregory removed 10 days - October 5 to October 14 - from the year 1582 and
+ proclaimed that from that time onwards 3 days would be dropped from the calendar
every 400 years.
- Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian).
+ Thursday, October 4, 1582 (Julian) was followed immediately by Friday, October 15, 1582 (Gregorian).
*/
if ($year <= 1582) {
- if ($year < 1582 ||
+ if ($year < 1582 ||
($year == 1582 && ($month < 10 || ($month == 10 && $day < 15)))) $greg_correction = 3;
else
$greg_correction = 0;
} else
$greg_correction = 0;
-
+
if($month > 2)
$month -= 2;
else {
@@ -192,12 +192,12 @@ class BitDate {
floor(($year % 100) / 4) +
floor(($year / 100) / 4) - 2 *
floor($year / 100) + 77 + $greg_correction;
-
+
return $day - 7 * floor($day / 7);
}
/**
- * Returns week of year, 1 = first week of year.
+ * Returns week of year, 1 = first week of year.
* Algorithm from PEAR::Date_Calc
* This needs to be checked out for both start day and early date rules
*/
@@ -209,29 +209,29 @@ class BitDate {
if ( $week_number == 0 ) $week_number = 53;
return $week_number;
}
-
+
/**
- * Checks for leap year, returns true if it is. No 2-digit year check. Also
+ * Checks for leap year, returns true if it is. No 2-digit year check. Also
* handles julian calendar correctly.
*/
- function _is_leap_year($year)
+ function _is_leap_year($year)
{
if ($year % 4 != 0) return false;
-
+
if ($year % 400 == 0) {
return true;
// if gregorian calendar (>1582), century not-divisible by 400 is not leap
} else if ($year > 1582 && $year % 100 == 0 ) {
return false;
- }
-
+ }
+
return true;
}
/**
* checks for leap year, returns true if it is. Has 2-digit year check
*/
- function is_leap_year($year)
+ function is_leap_year($year)
{
return $this->_is_leap_year($this->year_digit_check($year));
}
@@ -241,13 +241,13 @@ class BitDate {
* Assumes that if 2-digit is more than 30 years in future, then previous century.
* @ToDo This needs to be disabled when dates prior to 100AD are required in ISO format
*/
- function year_digit_check($y)
+ function year_digit_check($y)
{
if ($y < 100) {
-
+
$yr = (integer) date("Y");
$century = (integer) ($yr /100);
-
+
if ($yr%100 > 50) {
$c1 = $century + 1;
$c0 = $century;
@@ -279,13 +279,13 @@ class BitDate {
/*
* generate $YRS table for _adodb_getdate()
- *
+ *
function _date_gentable($out=true)
{
for ($i=1970; $i >= 1600; $i-=10) {
$s = adodb_gmmktime(0,0,0,1,1,$i);
- echo "$i => $s,<br>";
+ echo "$i => $s,<br>";
}
}
adodb_date_gentable();
@@ -304,25 +304,25 @@ class BitDate {
* and is much faster as it does not calculate dow, etc.
*/
function _getDate($origd=false,$fast=false,$is_gmt=false)
- {
+ {
static $YRS;
$d = $origd - ($is_gmt ? 0 : adodb_get_gmt_diff());
-
+
$_day_power = 86400;
$_hour_power = 3600;
$_min_power = 60;
-
- if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction
-
+
+ if ($d < -12219321600) $d -= 86400*10; // if 15 Oct 1582 or earlier, gregorian correction
+
$_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31);
$_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31);
-
+
$d366 = $_day_power * 366;
$d365 = $_day_power * 365;
-
+
if ($d < 0) {
-
+
if (empty($YRS)) $YRS = array(
1970 => 0,
1960 => -315619200,
@@ -364,10 +364,10 @@ class BitDate {
1600 => -11676096000);
if ($is_gmt) $origd = $d;
- // The valid range of a 32bit signed timestamp is typically from
+ // The valid range of a 32bit signed timestamp is typically from
// Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT
//
-
+
$lastsecs = 0;
$lastyear = 1970;
foreach($YRS as $year => $secs) {
@@ -378,24 +378,24 @@ class BitDate {
$lastsecs = $secs;
$lastyear = $year;
}
-
+
$d -= $lastsecs;
if (!isset($a)) $a = $lastyear;
-
+
for (; --$a >= 0;) {
$lastd = $d;
-
+
if ($leaf = _adodb_is_leap_year($a)) $d += $d366;
else $d += $d365;
-
+
if ($d >= 0) {
$year = $a;
break;
}
}
-
+
$secsInYear = 86400 * ($leaf ? 366 : 365) + $lastd;
-
+
$d = $lastd;
$mtab = ($leaf) ? $_month_table_leaf : $_month_table_normal;
for ($a = 13 ; --$a > 0;) {
@@ -407,17 +407,17 @@ class BitDate {
break;
}
}
-
+
$d = $lastd;
- $day = $ndays + ceil(($d+1) / ($_day_power));
+ $day = $ndays + ceil(($d+1) / ($_day_power));
$d += ($ndays - $day+1)* $_day_power;
$hour = floor($d/$_hour_power);
-
+
} else {
for ($a = 1970 ;; $a++) {
$lastd = $d;
-
+
if ($leaf = _adodb_is_leap_year($a)) $d -= $d366;
else $d -= $d365;
if ($d < 0) {
@@ -442,7 +442,7 @@ class BitDate {
$d = $d - ($day-1) * $_day_power;
$hour = floor($d /$_hour_power);
}
-
+
$d -= $hour * $_hour_power;
$min = floor($d/$_min_power);
$secs = $d - $min * $_min_power;
@@ -459,8 +459,8 @@ class BitDate {
'ndays' => $ndays
);
}
-
-
+
+
$dow = adodb_dow($year,$month,$day);
return array(
@@ -485,17 +485,17 @@ class BitDate {
{ if ( is_numeric($d) ) $this->date($fmt,$d,$is_gmt);
if ($d !== false) {
- if (!preg_match(
- "|^([0-9]{3,4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|",
+ if (!preg_match(
+ "|^([0-9]{3,4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|",
($d), $rr)) return $this->date($fmt,false,$is_gmt);
if ($rr[1] <= 100 && $rr[2]<= 1) return adodb_date($fmt,false,$is_gmt);
-
+
// h-m-s-MM-DD-YY
if (!isset($rr[5])) $d = adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
else $d = @adodb_mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]);
}
-
+
return $this->date($fmt,$d,$is_gmt);
}
@@ -514,20 +514,20 @@ class BitDate {
$_day_power = 86400;
$arr = $this->_getdate($d,true,$is_gmt);
-
+
// if (!isset($daylight)) $daylight = function_exists('adodb_daylight_sv');
// if ($daylight) adodb_daylight_sv($arr, $is_gmt);
-
+
$year = $arr['year'];
$month = $arr['mon'];
$day = $arr['mday'];
$hour = $arr['hours'];
$min = $arr['minutes'];
$secs = $arr['seconds'];
-
+
$max = strlen($fmt);
$dates = '';
-
+
/*
at this point, we have the following integer vars to manipulate:
$year, $month, $day, $hour, $min, $secs
@@ -538,21 +538,21 @@ class BitDate {
// YEAR
case 'L': $dates .= $arr['leap'] ? '1' : '0'; break;
case 'r': // Thu, 21 Dec 2000 16:01:07 +0200
-
+
// 4.3.11 uses '04 Jun 2004'
// 4.3.8 uses ' 4 Jun 2004'
- $dates .= gmdate('D',$_day_power*(3+$this->dow($year,$month,$day))).', '
+ $dates .= gmdate('D',$_day_power*(3+$this->dow($year,$month,$day))).', '
. ($day<10?'0'.$day:$day) . ' '.date('M',mktime(0,0,0,$month,2,1971)).' '.$year.' ';
-
- if ($hour < 10) $dates .= '0'.$hour; else $dates .= $hour;
-
+
+ if ($hour < 10) $dates .= '0'.$hour; else $dates .= $hour;
+
if ($min < 10) $dates .= ':0'.$min; else $dates .= ':'.$min;
-
+
if ($secs < 10) $dates .= ':0'.$secs; else $dates .= ':'.$secs;
-
+
$gmt = adodb_get_gmt_diff();
$dates .= sprintf(' %s%04d',($gmt<0)?'+':'-',abs($gmt)/36); break;
-
+
case 'Y': $dates .= $year; break;
case 'y': $dates .= substr($year,strlen($year)-2,2); break;
// MONTH
@@ -569,45 +569,45 @@ class BitDate {
case 'D': $dates .= gmdate('D',$_day_power*(3+adodb_dow($year,$month,$day))); break;
case 'j': $dates .= $day; break;
case 'd': if ($day<10) $dates .= '0'.$day; else $dates .= $day; break;
- case 'S':
+ case 'S':
$d10 = $day % 10;
if ($d10 == 1) $dates .= 'st';
else if ($d10 == 2 && $day != 12) $dates .= 'nd';
else if ($d10 == 3) $dates .= 'rd';
else $dates .= 'th';
break;
-
+
// HOUR
case 'Z':
$dates .= ($is_gmt) ? 0 : -adodb_get_gmt_diff(); break;
- case 'O':
+ case 'O':
$gmt = ($is_gmt) ? 0 : adodb_get_gmt_diff();
$dates .= sprintf('%s%04d',($gmt<0)?'+':'-',abs($gmt)/36); break;
-
- case 'H':
- if ($hour < 10) $dates .= '0'.$hour;
- else $dates .= $hour;
+
+ case 'H':
+ if ($hour < 10) $dates .= '0'.$hour;
+ else $dates .= $hour;
break;
- case 'h':
- if ($hour > 12) $hh = $hour - 12;
+ case 'h':
+ if ($hour > 12) $hh = $hour - 12;
else {
- if ($hour == 0) $hh = '12';
+ if ($hour == 0) $hh = '12';
else $hh = $hour;
}
-
+
if ($hh < 10) $dates .= '0'.$hh;
else $dates .= $hh;
break;
-
- case 'G':
+
+ case 'G':
$dates .= $hour;
break;
-
+
case 'g':
- if ($hour > 12) $hh = $hour - 12;
+ if ($hour > 12) $hh = $hour - 12;
else {
- if ($hour == 0) $hh = '12';
- else $hh = $hour;
+ if ($hour == 0) $hh = '12';
+ else $hh = $hour;
}
$dates .= $hh;
break;
@@ -629,7 +629,7 @@ class BitDate {
default:
$dates .= $fmt[$i]; break;
// ESCAPE
- case "\\":
+ case "\\":
$i++;
if ($i < $max) $dates .= $fmt[$i];
break;
@@ -637,28 +637,28 @@ class BitDate {
}
return $dates;
}
-
+
/**
- * Returns a timestamp given a GMT/UTC time.
+ * Returns a timestamp given a GMT/UTC time.
* Note that $is_dst is not implemented and is ignored.
*/
function gmmktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false)
{
return $this->mktime($hr,$min,$sec,$mon,$day,$year,$is_dst,true);
}
-
+
/**
* Return a timestamp given a local time. Originally by jackbbs.
* Note that $is_dst is not implemented and is ignored.
-
+
* Not a very fast algorithm - O(n) operation. Could be optimized to O(1).
*/
- function mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false,$is_gmt=false)
+ function mktime($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_dst=false,$is_gmt=false)
{
if ($mon === false) {
return $is_gmt? @gmmktime($hr,$min,$sec): @mktime($hr,$min,$sec);
-
- // for windows, we don't check 1970 because with timezone differences,
+
+ // for windows, we don't check 1970 because with timezone differences,
// 1 Jan 1970 could generate negative timestamp, which is illegal
if (1971 < $year && $year < 2038
|| !defined('ADODB_NO_NEGATIVE_TS') && (1901 < $year && $year < 2038)
@@ -668,9 +668,9 @@ class BitDate {
@mktime($hr,$min,$sec,$mon,$day,$year);
}
}
-
+
$gmt_different = ($is_gmt) ? 0 : $this->server_offset;
-
+
/*
# disabled because some people place large values in $sec.
# however we need it for $mon because we use an array...
@@ -681,23 +681,23 @@ class BitDate {
$mon = intval($mon);
$day = intval($day);
$year = intval($year);
-
-
+
+
$year = $this->year_digit_check($year);
-
+
if ($mon > 12) {
$y = floor($mon / 12);
$year += $y;
$mon -= $y*12;
}
-
+
$_day_power = 86400;
$_hour_power = 3600;
$_min_power = 60;
-
+
$_month_table_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31);
$_month_table_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31);
-
+
$_total_date = 0;
if ($year >= 1970) {
for ($a = 1970 ; $a <= $year; $a++) {
@@ -709,7 +709,7 @@ class BitDate {
$loop_table = $_month_table_normal;
$_add_date = 365;
}
- if ($a < $year) {
+ if ($a < $year) {
$_total_date += $_add_date;
} else {
for($b=1;$b<$mon;$b++) {
@@ -719,7 +719,7 @@ class BitDate {
}
$_total_date +=$day-1;
$ret = $_total_date * $_day_power + $hr * $_hour_power + $min * $_min_power + $sec + $gmt_different;
-
+
} else {
for ($a = 1969 ; $a >= $year; $a--) {
$leaf = _adodb_is_leap_year($a);
@@ -738,41 +738,41 @@ class BitDate {
}
}
$_total_date += $loop_table[$mon] - $day;
-
+
$_day_time = $hr * $_hour_power + $min * $_min_power + $sec;
$_day_time = $_day_power - $_day_time;
$ret = -( $_total_date * $_day_power + $_day_time - $gmt_different);
if ($ret < -12220185600) $ret += 10*86400; // if earlier than 5 Oct 1582 - gregorian correction
else if ($ret < -12219321600) $ret = -12219321600; // if in limbo, reset to 15 Oct 1582.
- }
+ }
//print " dmy=$day/$mon/$year $hr:$min:$sec => " .$ret;
return $ret;
}
-
+
function gmstrftime($fmt, $ts=false)
{
return strftime($fmt,$ts,true);
}
-
+
// hack - convert to adodb_date
function strftime($fmt, $ts=false,$is_gmt=false)
{
global $ADODB_DATE_LOCALE;
-
+
if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range
if (!defined('ADODB_NO_NEGATIVE_TS') || $ts >= 0) // if windows, must be +ve integer
return ($is_gmt)? @gmstrftime($fmt,$ts): @strftime($fmt,$ts);
}
-
+
if (empty($ADODB_DATE_LOCALE)) {
$tstr = strtoupper(gmstrftime('%c',31366800)); // 30 Dec 1970, 1 am
$sep = substr($tstr,2,1);
$hasAM = strrpos($tstr,'M') !== false;
-
+
$ADODB_DATE_LOCALE = array();
- $ADODB_DATE_LOCALE[] = strncmp($tstr,'30',2) == 0 ? 'd'.$sep.'m'.$sep.'y' : 'm'.$sep.'d'.$sep.'y';
+ $ADODB_DATE_LOCALE[] = strncmp($tstr,'30',2) == 0 ? 'd'.$sep.'m'.$sep.'y' : 'm'.$sep.'d'.$sep.'y';
$ADODB_DATE_LOCALE[] = ($hasAM) ? 'h:i:s a' : 'H:i:s';
-
+
}
$inpct = false;
$fmtdate = '';
@@ -785,7 +785,7 @@ class BitDate {
} else
$inpct = true;
} else if ($inpct) {
-
+
$inpct = false;
switch($ch) {
case '0':
@@ -801,9 +801,9 @@ class BitDate {
case 'E':
case 'O':
/* ignore format modifiers */
- $inpct = true;
+ $inpct = true;
break;
-
+
case 'a': $fmtdate .= 'D'; break;
case 'A': $fmtdate .= 'l'; break;
case 'h':
@@ -848,7 +848,7 @@ class BitDate {
$ret = $this->date($fmtdate, $ts, $is_gmt);
return $ret;
}
-
+
/**
* Converts from Gregorian Year-Month-Day to ISO YearNumber-WeekNumber-WeekDay
*
@@ -867,10 +867,10 @@ class BitDate {
if ($month == 0) {
$year--;
$month = 12;
- }
+ }
$y_isleap = $this->is_leap_year($year);
$y_1_isleap = $this->is_leap_year($year - 1);
-
+
$day_of_year_number = $day + $mnth[$month - 1];
if ($y_isleap && $month > 2) {
$day_of_year_number++;
@@ -1029,5 +1029,119 @@ class BitDate {
}
}
+ /**
+ * Convert the time into managable chunks to display: ... hour(s) ... minute(s) ago
+ * @param $pTimeStamp timestamp that should be converted
+ * @param $pThreshold the threshold at which it should stop converting
+ * @return translated array with strings for each time unit
+ * @access public
+ **/
+ function calculateTimeDifference( $pTimeStart, $pTimeStop=NULL, $pThreshold=NULL ) {
+ global $gBitSystem;
+
+ $timeUnits = array(
+ // number of seconds for each tine unit
+ 'always' => 315569260000, // 10000 years
+ 'year' => 31556926, // taken from http://www.google.com/search?num=50&hs=i64&hl=en&lr=&client=opera&rls=en&q=seconds+in+year&btnG=Search
+ 'month' => 2629743, // taken from http://www.google.com/search?num=50&hs=nkP&hl=en&lr=&client=opera&rls=en&q=seconds+in+month&btnG=Search
+ 'week' => 604800,
+ 'day' => 86400,
+ 'hour' => 3600,
+ 'minute' => 60,
+ 'second' => 1,
+ );
+
+ $timeDiff = ( !empty( $pTimeStop ) ? $pTimeStop : $gBitSystem->mServerTimestamp->getUTCTime() ) - $pTimeStart;
+
+ // work out if we're looking ahead or back in time
+ if( $timeDiff <= 0 ) {
+ $timeDiff = 0 - $timeDiff;
+ $ret['orientation'] = 'future';
+ } else {
+ $ret['orientation'] = 'past';
+ }
+
+ if( !empty( $pThreshold ) && in_array( $pThreshold, array_keys( $timeUnits ) ) ) {
+ if( $timeDiff >= $timeUnits[$pThreshold] ) {
+ return FALSE;
+ } elseif( $timeDiff == 0 ) {
+ $ret['strings'] = tra( 'now' );
+ } else {
+ foreach( $timeUnits as $name => $unit ) {
+ if( $name != 'always' ) {
+ // return array of units with count
+ $ret['units'][$name] = floor( $timeDiff / $unit );
+ }
+
+ if( $timeDiff >= $unit || !empty( $ret['strings'] ) ) {
+ // return translated string
+ $ret['strings'][] = floor( $timeDiff / $unit ).' '.tra( $name.'(s)' );
+ // set $timeDiff for next loop
+ $timeDiff = fmod( $timeDiff, $unit );
+ }
+ }
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Get a hash of holidays for a given year
+ * @param $pYear the year in question
+ * @param $pCountryCode -- the country in question - only US is supported currently
+ * @return an associative array containing the holidays occuring in the given year they key is a date stamp of the form Y-m-d, the value is the name of the corresponding holiday
+ * @access public
+ **/
+ function getHolidays( $pYear, $pCountryCode='US' ) {
+ $return = array();
+
+ switch( $pCountryCode ) {
+ case 'UK':
+ $return[date( 'Y-m-d', strtotime("-1 week monday", strtotime("1 september $pYear")) + 43200)] = 'Bank Holiday';
+ break;
+ case 'US':
+ default:
+ // First off, the simple ones
+ $return[$pYear . '-01-01'] = 'New Year`s Day';
+ $return[$pYear . '-02-14'] = 'Valentine`s Day';
+ $return[$pYear . '-06-14'] = 'Flag Day';
+ $return[$pYear . '-07-04'] = 'Independence Day';
+ $return[$pYear . '-11-11'] = 'Veteran`s Day';
+ $return[$pYear . '-12-25'] = 'Christmas';
+
+ // Martin Luther King, Jr. Day - third Monday in January
+ $return[date( 'Y-m-d', strtotime( '2 weeks monday', strtotime( "January 1, $pYear" ) ) + 43200 )] = 'Martin Luther King, Jr. Day';
+
+ // Presidents` Day - third Monday in February
+ $return[date( 'Y-m-d', strtotime( '2 weeks monday', strtotime( "February 1, $pYear" ) ) + 43200 )] = 'Presidents` Day';
+
+ // Mardi Gras - Tuesday ~47 days before Easter
+ $return[date( 'Y-m-d', strtotime( 'last tuesday 46 days ago', easter_date( $pYear ) ) + 43200 )] = 'Mardi Gras';
+
+ // Memorial Day - last Monday in May
+ $return[date( 'Y-m-d', strtotime( '-1 week monday', strtotime( "June 1, $pYear" ) ) + 43200 )] = 'Memorial Day';
+
+ // Labor Day - first Monday in September
+ $return[date( 'Y-m-d', strtotime( 'monday', strtotime( "September 1, $pYear" ) ) + 43200 )] = 'Labor Day';
+
+ // Columbus Day - second Monday in October
+ $return[date( 'Y-m-d', strtotime( '1 week monday', strtotime( "October 1, $pYear" ) ) + 43200 )] = 'Columbus Day';
+
+ // Thanksgiving - fourth Thursday in November
+ $return[date( 'Y-m-d', strtotime( '3 weeks thursday', strtotime( "November 1, $pYear" ) ) + 43200 )] = 'Thanksgiving';
+
+ ksort( $return );
+ break;
+ }
+
+ // Common to all
+
+ // Easter - the Sunday after the first full moon which falls on or after the Spring Equinox
+ // thank god PHP has a function for that...
+ $return[date( 'Y-m-d', easter_date( $pYear ) + 43200 )] = 'Easter';
+
+ return $return;
+
+ }
}
-?> \ No newline at end of file
+?>
diff --git a/BitSystem.php b/BitSystem.php
index b5b0322..2cd7179 100755
--- a/BitSystem.php
+++ b/BitSystem.php
@@ -3,7 +3,7 @@
* Main bitweaver systems functions
*
* @package kernel
- * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSystem.php,v 1.17 2005/10/23 14:40:22 squareing Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_kernel/BitSystem.php,v 1.18 2005/10/29 17:53:54 squareing Exp $
* @author spider <spider@steelsun.com>
*/
// +----------------------------------------------------------------------+
@@ -655,6 +655,12 @@ class BitSystem extends BitBase {
define($pkgDefine, BIT_ROOT_URL . basename( $pPackagePath ) . '/');
}
+ // Define <PACKAGE>_PKG_URI
+ $pkgDefine = $pkgName.'_PKG_URI';
+ if (!defined($pkgDefine) && defined( 'BIT_BASE_URI' ) ) {
+ define($pkgDefine, BIT_BASE_URI . basename( $pPackagePath ) . '/');
+ }
+
// Define <PACKAGE>_PKG_NAME
$pkgDefine = $pkgName.'_PKG_NAME';
if (!defined($pkgDefine)) {
@@ -1477,25 +1483,19 @@ asort( $this->mAppMenu );
$docroot = BIT_ROOT_PATH;
- if (ini_get('session.save_handler') == 'files')
- {
+ if (ini_get('session.save_handler') == 'files') {
$save_path = ini_get('session.save_path');
- if (!is_dir($save_path))
- {
+ if (!is_dir($save_path)) {
$errors .= "The directory '$save_path' does not exist or PHP is not allowed to access it (check open_basedir entry in php.ini).\n";
- }
- else if (!bw_is_writeable($save_path))
- {
+ } else if (!bw_is_writeable($save_path)) {
$errors .= "The directory '$save_path' is not writeable.\n";
}
- if ($errors)
- {
+ if ($errors) {
$save_path = getTempDir();
- if (is_dir($save_path) && bw_is_writeable($save_path))
- {
+ if (is_dir($save_path) && bw_is_writeable($save_path)) {
ini_set('session.save_path', $save_path);
$errors = '';
@@ -1506,8 +1506,7 @@ asort( $this->mAppMenu );
$wwwuser = '';
$wwwgroup = '';
- if (isWindows())
- {
+ if (isWindows()) {
if ( strpos($_SERVER["SERVER_SOFTWARE"],"IIS") && isset($_SERVER['COMPUTERNAME']) ) {
$wwwuser = 'IUSR_'.$_SERVER['COMPUTERNAME'];
$wwwgroup = 'IUSR_'.$_SERVER['COMPUTERNAME'];
@@ -1517,8 +1516,7 @@ asort( $this->mAppMenu );
}
}
- if (function_exists('posix_getuid'))
- {
+ if (function_exists('posix_getuid')) {
$userhash = @posix_getpwuid(@posix_getuid());
$group = @posix_getpwuid(@posix_getgid());
@@ -1526,110 +1524,112 @@ asort( $this->mAppMenu );
$wwwgroup = $group ? $group['name'] : false;
}
- if (!$wwwuser)
- {
+ if (!$wwwuser) {
$wwwuser = 'nobody (or the user account the web server is running under)';
}
- if (!$wwwgroup)
- {
+ if (!$wwwgroup) {
$wwwgroup = 'nobody (or the group account the web server is running under)';
}
-$permFiles = array(
- 'temp/'
-);
+ $permFiles = array(
+ 'temp/'
+ );
- foreach($permFiles as $file) {
+ foreach( $permFiles as $file ) {
$present = FALSE;
// Create directories as needed
$target = BIT_ROOT_PATH . $file;
if( preg_match( '/.*\/$/', $target ) ) {
// we have a directory
- if( !is_dir($target) ) {
- mkdir_p($target, 02775);
+ if( !is_dir( $target ) ) {
+ mkdir_p( $target, 02775 );
}
// Check again and report problems
- if (!is_dir($target)) {
- if (!isWindows())
- { $errors .= "<p>The directory <b style='color:red;'>$target</b> does not exist. To create the directory, execute a command such as:<pre>
- \$ mkdir -m 777 $target
- </pre></p>";
- } else { $errors .= "<p>The directory <b style='color:red;'>$target</b> does not exist. Create the directory $target before proceeding
- </pre></p>";
+ if( !is_dir( $target ) ) {
+ if( !isWindows() ) {
+ $errors .= "
+ <p>The directory <strong style='color:red;'>$target</strong> does not exist. To create the directory, execute a command such as:</p>
+ <pre>\$ mkdir -m 777 $target</pre>
+ ";
+ } else {
+ $errors .= "<p>The directory <strong style='color:red;'>$target</strong> does not exist. Create the directory $target before proceeding</p>";
}
} else {
$present = TRUE;
}
} elseif( !file_exists( $target ) ) {
- if (!isWindows())
- { $errors .= "<p>The file <b style='color:red;'>$target</b> does not exist. To create the file, execute a command such as:<pre>
- \$ touch $target
- \$ chmod 777 $target
- </pre></p>";
- } else { $errors .= "<p>The file <b style='color:red;'>$target</b> does not exist. Create a blank file $target before proceeding
- </pre></p>";
+ if( !isWindows()) {
+ $errors .= "<p>The file <b style='color:red;'>$target</b> does not exist. To create the file, execute a command such as:</p>
+ <pre>
+ \$ touch $target
+ \$ chmod 777 $target
+ </pre>
+ ";
+ } else {
+ $errors .= "<p>The file <b style='color:red;'>$target</b> does not exist. Create a blank file $target before proceeding</p>";
}
} else {
$present = TRUE;
}
// chmod( $target, 02775 );
- if( $present && (!bw_is_writeable($target))) {
+ if( $present && ( !bw_is_writeable( $target ) ) ) {
if (!isWindows())
- { $errors .= "<p><b style='color:red;'>$target</b> is not writeable by $wwwuser. To give $wwwuser write permission, execute a command such as:<pre>
- \$ chmod 777 $target
-</pre></p>";
- } else { $errors .= "<p><b style='color:red;'>$target</b> is not writeable by $wwwuser. Check the security of the file $target before proceeding
- </pre></p>";
+ { $errors .= "<p><strong style='color:red;'>$target</strong> is not writeable by $wwwuser. To give $wwwuser write permission, execute a command such as:</p>
+ <pre>\$ chmod 777 $target</pre>";
+ } else {
+ $errors .= "<p><b style='color:red;'>$target</b> is not writeable by $wwwuser. Check the security of the file $target before proceeding</p>";
}
}
- // if (!is_dir("$docroot/$dir"))
- // {
- // $errors .= "The directory '$docroot$dir' does not exist.\n";
- // }
- // else if (!bw_is_writeable("$docroot/$dir"))
- // {
- // $errors .= "The directory '$docroot$dir' is not writeable by $wwwuser.\n";
- // }
+ //if (!is_dir("$docroot/$dir")) {
+ // $errors .= "The directory '$docroot$dir' does not exist.\n";
+ //} else if (!bw_is_writeable("$docroot/$dir")) {
+ // $errors .= "The directory '$docroot$dir' is not writeable by $wwwuser.\n";
+ //}
}
- if ($errors)
- {
+ if( $errors ) {
$PHP_CONFIG_FILE_PATH = PHP_CONFIG_FILE_PATH;
ob_start();
phpinfo (INFO_MODULES);
$httpd_conf = 'httpd.conf';
- if (preg_match('/Server Root<\/b><\/td><td\s+align="left">([^<]*)</', ob_get_contents(), $m))
- {
+ if (preg_match('/Server Root<\/b><\/td><td\s+align="left">([^<]*)</', ob_get_contents(), $m)) {
$httpd_conf = $m[1] . '/' . $httpd_conf;
}
ob_end_clean();
print "
-<html><body>
-<h2><font color='red'>bitweaver is not properly set up:</font></h1>
-<ul>
-$errors
-</ul>";
+ <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">
+ <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">
+ <head>
+ <title>bitweaver setup problems</title>
+ <meta http-equiv=\"Pragma\" content=\"no-cache\" />
+ <meta http-equiv=\"Expires\" content=\"-1\" />
+ </head>
+ <body>
+ <h1 style=\"color:red;\">bitweaver is not properly set up:</h1>
+ <blockquote>
+ $errors
+ </blockquote>
+ ";
+
if( !defined( 'IS_LIVE' ) || !IS_LIVE ) {
- if (!isWindows())
- {
+ if (!isWindows()) {
print "
- Proceed to the installer <b>at <a href=\"".BIT_ROOT_URL."install/install.php\">".BIT_ROOT_URL."install/install.php</a></b> after you run the command.
- <br />Consult the bitweaver<a href='http://www.bitweaver.org/wiki/index.php?page=Technical_Documentation' target='_blank'>Technical Documentation</a> if you need more help.
- </body></html>";
- }
- else
- {
+ <p>Proceed to the installer <strong>at <a href=\"".BIT_ROOT_URL."install/install.php\">".BIT_ROOT_URL."install/install.php</a></strong> after you run the command.
+ <br />Consult the bitweaver<a href='http://www.bitweaver.org/wiki/index.php?page=Technical_Documentation'>Technical Documentation</a> if you need more help.</p>
+ ";
+ } else {
print "
- Proceed to the installer <b>at <a href=\"".BIT_ROOT_URL."install/install.php\">".BIT_ROOT_URL."install/install.php</a></b> after you have corrected the identified problems.
- <br />Consult the bitweaver<a href='http://www.bitweaver.org/wiki/index.php?page=Technical_Documentation' target='_blank'>Technical Documentation</a> if you need more help.
- </body></html>";
+ <p>Proceed to the installer <strong>at <a href=\"".BIT_ROOT_URL."install/install.php\">".BIT_ROOT_URL."install/install.php</a></strong> after you have corrected the identified problems.
+ <br />Consult the bitweaver<a href='http://www.bitweaver.org/wiki/index.php?page=Technical_Documentation'>Technical Documentation</a> if you need more help.</p>
+ ";
}
+ print "</body></html>";
}
exit;
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index d1efac9..cebe9a8 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -3,130 +3,130 @@
$tables = array(
'adodb_logsql' => "
- created T NOT NULL,
- sql0 C(250) NOTNULL,
- sql1 X NOTNULL,
- params X NOTNULL,
- tracer X NOTNULL,
- timer N(16.6) NOTNULL
+ created T NOT NULL,
+ sql0 C(250) NOTNULL,
+ sql1 X NOTNULL,
+ params X NOTNULL,
+ tracer X NOTNULL,
+ timer N(16.6) NOTNULL
",
'tiki_banning' => "
- ban_id I4 AUTO PRIMARY,
- mode C(4),
- title C(200),
- ip1 C(3),
- ip2 C(3),
- ip3 C(3),
- ip4 C(3),
- `user` C(40),
- date_from T NOTNULL,
- date_to T NOTNULL,
- use_dates C(1),
- created I8,
- message X
+ ban_id I4 AUTO PRIMARY,
+ mode C(4),
+ title C(200),
+ ip1 C(3),
+ ip2 C(3),
+ ip3 C(3),
+ ip4 C(3),
+ `user` C(40),
+ date_from T NOTNULL,
+ date_to T NOTNULL,
+ use_dates C(1),
+ created I8,
+ message X
",
'tiki_banning_sections' => "
- ban_id I4 PRIMARY,
- section C(100) PRIMARY
+ ban_id I4 PRIMARY,
+ section C(100) PRIMARY
",
'tiki_content_templates' => "
- template_id I4 AUTO PRIMARY,
- content X,
- name C(200),
- created I8
+ template_id I4 AUTO PRIMARY,
+ content X,
+ name C(200),
+ created I8
",
'tiki_content_templates_sections' => "
- template_id I4 PRIMARY,
- section C(160) PRIMARY
+ template_id I4 PRIMARY,
+ section C(160) PRIMARY
",
'tiki_cookies' => "
- cookie_id I4 AUTO PRIMARY,
- cookie C(255)
+ cookie_id I4 AUTO PRIMARY,
+ cookie C(255)
",
'tiki_dsn' => "
- dsn_id I4 AUTO PRIMARY,
- name C(200) NOTNULL,
- dsn C(255)
+ dsn_id I4 AUTO PRIMARY,
+ name C(200) NOTNULL,
+ dsn C(255)
",
'tiki_dynamic_variables' => "
- name C(40) PRIMARY,
- data X
+ name C(40) PRIMARY,
+ data X
",
'tiki_layouts' => "
- user_id I4 NOTNULL,
- module_id I4 NOTNULL,
- layout C(160) NOTNULL DEFAULT 'home',
- position C(1) NOTNULL,
- rows I4,
- params C(255),
- ord I4 NOTNULL DEFAULT '1'
+ user_id I4 NOTNULL,
+ module_id I4 NOTNULL,
+ layout C(160) NOTNULL DEFAULT 'home',
+ position C(1) NOTNULL,
+ rows I4,
+ params C(255),
+ ord I4 NOTNULL DEFAULT '1'
",
'tiki_layouts_modules' => "
- module_id I4 PRIMARY,
- availability C(1),
- title C(255),
- cache_time I8,
- rows I4,
- params C(255),
- groups X
+ module_id I4 PRIMARY,
+ availability C(1),
+ title C(255),
+ cache_time I8,
+ rows I4,
+ params C(255),
+ groups X
",
'tiki_mail_events' => "
- event C(200),
- object C(200),
- email C(200)
+ event C(200),
+ object C(200),
+ email C(200)
",
'tiki_menu_options' => "
- option_id I4 AUTO PRIMARY,
- menu_id I4,
- type C(1),
- name C(200),
- url C(255),
- position I4,
- section C(255),
- perm C(255),
- groupname C(255)
+ option_id I4 AUTO PRIMARY,
+ menu_id I4,
+ type C(1),
+ name C(200),
+ url C(255),
+ position I4,
+ section C(255),
+ perm C(255),
+ groupname C(255)
",
'tiki_menus' => "
- menu_id I4 AUTO PRIMARY,
- name C(200) NOTNULL,
- description X,
- type C(1)
+ menu_id I4 AUTO PRIMARY,
+ name C(200) NOTNULL,
+ description X,
+ type C(1)
",
'tiki_module_map' => "
- module_id I4 AUTO PRIMARY,
- module_rsrc C(250) NOTNULL
+ module_id I4 AUTO PRIMARY,
+ module_rsrc C(250) NOTNULL
",
'tiki_pageviews' => "
- day I8 PRIMARY,
- pageviews I8
+ day I8 PRIMARY,
+ pageviews I8
",
'tiki_preferences' => "
- name C(40) PRIMARY,
- package C(100),
- value C(250)
+ name C(40) PRIMARY,
+ package C(100),
+ value C(250)
",
'tiki_programmed_content' => "
- p_id I4 AUTO PRIMARY,
- content_id I4 NOTNULL,
- publish_date I8 NOTNULL,
- data X
+ p_id I4 AUTO PRIMARY,
+ content_id I4 NOTNULL,
+ publish_date I8 NOTNULL,
+ data X
",
);
@@ -155,48 +155,48 @@ $gBitInstaller->registerPackageInfo( KERNEL_PKG_NAME, array(
// ### Default Preferences
$gBitInstaller->registerPreferences( KERNEL_PKG_NAME, array(
- array('kernel','feature_help','y'),
- array('kernel','feature_wikihelp','y'),
- array('kernel','feature_helpnotes','y'),
- array('kernel','short_date_format','%d %b %Y'),
- array('kernel','short_time_format','%H:%M %Z'),
- array('kernel','siteTitle',''),
- array('kernel','centralized_upload_dir','storage'),
- array('kernel','tmpDir','temp'),
- array('kernel','use_proxy','n'),
- array('kernel','proxy_host',''),
- array('kernel','proxy_port',''),
- array('kernel','user_assigned_modules','n'),
- array('kernel','http_domain',''),
- array('kernel','http_port','80'),
- array('kernel','http_prefix','/'),
- array('kernel','https_domain',''),
- array('kernel','https_login','n'),
- array('kernel','https_login_required','n'),
- array('kernel','https_port','443'),
- array('kernel','https_prefix','/'),
- array('kernel','feature_bot_bar','y'),
- array('kernel','feature_top_bar','y'),
- array('kernel','feature_banning','n'),
- array('kernel','feature_contact','n'),
- array('kernel','feature_jstabs','y' ),
- array('kernel','contact_user','admin'),
- array('kernel','count_admin_pvs','y'),
- array('kernel','direct_pagination','n'),
- array('kernel','display_timezone','UTC'),
- array('kernel','long_date_format','%A %d of %B, %Y'),
- array('kernel','long_time_format','%H:%M:%S %Z'),
- array('kernel','feature_left_column','y'),
- array('kernel','feature_right_column','y'),
- array('kernel','maxRecords','10'),
- array('kernel','language','en'),
- array('kernel','sender_email',''),
- array('kernel','urlIndex',''),
- array('themes','feature_bidi','n' ),
- array('themes','slide_style', DEFAULT_THEME ),
- array('themes','style', DEFAULT_THEME ),
- array('themes','feature_theme_control','n' ),
- array('themes','feature_top_bar_dropdown','y' )
+ array(KERNEL_PKG_NAME,'feature_help','y'),
+ array(KERNEL_PKG_NAME,'feature_wikihelp','y'),
+ array(KERNEL_PKG_NAME,'feature_helpnotes','y'),
+ array(KERNEL_PKG_NAME,'short_date_format','%d %b %Y'),
+ array(KERNEL_PKG_NAME,'short_time_format','%H:%M %Z'),
+ array(KERNEL_PKG_NAME,'siteTitle',''),
+ array(KERNEL_PKG_NAME,'centralized_upload_dir','storage'),
+ array(KERNEL_PKG_NAME,'tmpDir','temp'),
+ array(KERNEL_PKG_NAME,'use_proxy','n'),
+ array(KERNEL_PKG_NAME,'proxy_host',''),
+ array(KERNEL_PKG_NAME,'proxy_port',''),
+ array(KERNEL_PKG_NAME,'user_assigned_modules','n'),
+ array(KERNEL_PKG_NAME,'http_domain',''),
+ array(KERNEL_PKG_NAME,'http_port','80'),
+ array(KERNEL_PKG_NAME,'http_prefix','/'),
+ array(KERNEL_PKG_NAME,'https_domain',''),
+ array(KERNEL_PKG_NAME,'https_login','n'),
+ array(KERNEL_PKG_NAME,'https_login_required','n'),
+ array(KERNEL_PKG_NAME,'https_port','443'),
+ array(KERNEL_PKG_NAME,'https_prefix','/'),
+ array(KERNEL_PKG_NAME,'feature_bot_bar','y'),
+ array(KERNEL_PKG_NAME,'feature_top_bar','y'),
+ array(KERNEL_PKG_NAME,'feature_banning','n'),
+ array(KERNEL_PKG_NAME,'feature_contact','n'),
+ array(KERNEL_PKG_NAME,'feature_jstabs','y' ),
+ array(KERNEL_PKG_NAME,'contact_user','admin'),
+ array(KERNEL_PKG_NAME,'count_admin_pvs','y'),
+ array(KERNEL_PKG_NAME,'direct_pagination','n'),
+ array(KERNEL_PKG_NAME,'display_timezone','UTC'),
+ array(KERNEL_PKG_NAME,'long_date_format','%A %d of %B, %Y'),
+ array(KERNEL_PKG_NAME,'long_time_format','%H:%M:%S %Z'),
+ array(KERNEL_PKG_NAME,'feature_left_column','y'),
+ array(KERNEL_PKG_NAME,'feature_right_column','y'),
+ array(KERNEL_PKG_NAME,'maxRecords','10'),
+ array(KERNEL_PKG_NAME,'language','en'),
+ array(KERNEL_PKG_NAME,'sender_email',''),
+ array(KERNEL_PKG_NAME,'urlIndex',''),
+ array(THEMES_PKG_NAME,'feature_bidi','n' ),
+ array(THEMES_PKG_NAME,'slide_style', DEFAULT_THEME ),
+ array(THEMES_PKG_NAME,'style', DEFAULT_THEME ),
+ array(THEMES_PKG_NAME,'feature_theme_control','n' ),
+ array(THEMES_PKG_NAME,'feature_top_bar_dropdown','y' )
) );
$moduleHash = array(
@@ -231,10 +231,10 @@ $gBitInstaller->registerModules( $moduleHash );
// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( KERNEL_PKG_NAME, array(
- array('bit_p_admin', 'Can manage users groups and permissions and all aspects of site management', 'admin', 'kernel' ),
- array('bit_p_edit_cookies', 'Can admin cookies', 'editors', 'kernel'),
- array('bit_p_admin_banning', 'Can ban users or IPs', 'admin', 'kernel'),
- array('bit_p_access_closed_site', 'Can access site when closed', 'admin', 'kernel')
+ array('bit_p_admin', 'Can manage users groups and permissions and all aspects of site management', 'admin', KERNEL_PKG_NAME ),
+ array('bit_p_edit_cookies', 'Can admin cookies', 'editors', KERNEL_PKG_NAME),
+ array('bit_p_admin_banning', 'Can ban users or IPs', 'admin', KERNEL_PKG_NAME),
+ array('bit_p_access_closed_site', 'Can access site when closed', 'admin', KERNEL_PKG_NAME)
) );
?>
diff --git a/bit_error_inc.php b/bit_error_inc.php
index d615dfa..b8d267f 100755
--- a/bit_error_inc.php
+++ b/bit_error_inc.php
@@ -204,7 +204,7 @@ function vd( $iVar ) {
unset( $iVar->mDb );
}
var_dump( $iVar );
- } elseif( is_string( $iVar ) ) {
+ } elseif( is_string( $iVar ) && !empty( $_SERVER['HTTP_USER_AGENT'] ) && $_SERVER['HTTP_USER_AGENT'] != 'cron' ) {
var_dump( htmlentities( $iVar ) );
} else {
var_dump( $iVar );
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 90c1ec3..c93da72 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -40,6 +40,7 @@ if (!defined('BIT_ROOT_URL' )) {
$subpath = ( isset($match[0] ) ) ? $match[0] : '/';
define('BIT_ROOT_URL', $subpath );
}
+
if( !defined( 'BIT_SESSION_NAME' ) ) {
define( 'BIT_SESSION_NAME', 'BWSESSION' );
}
diff --git a/setup_inc.php b/setup_inc.php
index 3eacbc9..ab7cb8b 100644
--- a/setup_inc.php
+++ b/setup_inc.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_kernel/setup_inc.php,v 1.16 2005/10/12 15:13:51 spiderr Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_kernel/setup_inc.php,v 1.17 2005/10/29 17:53:54 squareing Exp $
* @package kernel
* @subpackage functions
*/
@@ -64,6 +64,10 @@ $gRefreshSitePrefs = FALSE;
global $gBitSmarty, $gBitSystem;
$gBitSystem = new BitSystem();
+// array used to load stuff using <body onload="">
+global $gBodyOnload;
+$gBitSmarty->assign_by_ref( 'gBodyOnload', $gBodyOnload = array() );
+
global $gPreviewStyle;
$gPreviewStyle = FALSE;
BitSystem::prependIncludePath(UTIL_PKG_PATH . '/');
@@ -110,11 +114,21 @@ if( $gBitSystem->isDatabaseValid() ) {
require_once( BIT_ROOT_PATH.'liberty/bit_setup_inc.php' );
}
+ $host = $gBitSystem->getPreference( 'feature_server_name', $_SERVER['HTTP_HOST'] );
+ if( !defined('BIT_BASE_URI' ) ) {
+ define( 'BIT_BASE_URI', 'http://'.$host );
+ }
+
$gBitSystem->scanPackages();
// some plugins check for active packages, so we do this *after* package scanning
global $gLibertySystem;
$gLibertySystem->scanPlugins();
+ // XSS security check
+ if( !empty( $_REQUEST['tk'] ) ) {
+ $gBitUser->verifyTicket();
+ }
+
// setStyle first, in case package decides it wants to reset the style in it's own <package>/bit_setup_inc.php
$theme = $gBitSystem->getStyle();
$theme = !empty($theme) ? $theme : 'basic';
diff --git a/smarty_bit/block.jstab.php b/smarty_bit/block.jstab.php
index 41fb7c9..1d738f3 100644
--- a/smarty_bit/block.jstab.php
+++ b/smarty_bit/block.jstab.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* Smarty plugin
* @package Smarty
@@ -10,7 +10,7 @@
*
* Type: block
* Name: jstab
- * Input:
+ * Input:
* Abstract: Used to enclose a set of tabs
*/
function smarty_block_jstab($params, $content, &$gBitSmarty) {
diff --git a/smarty_bit/block.jstabs.php b/smarty_bit/block.jstabs.php
index b34aa85..4ba7a95 100644
--- a/smarty_bit/block.jstabs.php
+++ b/smarty_bit/block.jstabs.php
@@ -20,12 +20,20 @@ function smarty_block_jstabs( $params, $content, &$gBitSmarty ) {
if( $gBitSystem->mPrefs['disable_jstabs'] == 'y' ) {
$ret .= '<div class="tabpane">'.$content.'</div>';
} else {
- $id = 1000000 * microtime();
- $ret .= '<div class="tabpane" id="id_'.$id.'">';
- $ret .= "<script type=\"text/javascript\">//<![CDATA[\ntabPane = new WebFXTabPane( document.getElementById( 'id_".$id."' ), true );\n//]]></script>";
- $ret .= $content;
- $ret .= "<script type=\"text/javascript\">//<![CDATA[\nsetupAllTabs();\nvar tabPane;".( !empty( $tab ) ? "\ntabPane.setSelectedIndex( $tab );" : '' )."\n//]]></script>";
- $ret .= '</div>';
+ if( !empty( $tab ) ) {
+ $id = 1000000 * microtime();
+ $ret .= '<div class="tabpane" id="id_'.$id.'">';
+ $ret .= "<script type=\"text/javascript\">//<![CDATA[\ntabPane = new WebFXTabPane( document.getElementById( 'id_".$id."' ), true );\n//]]></script>";
+ $ret .= $content;
+ $ret .= "<script type=\"text/javascript\">//<![CDATA[\nsetupAllTabs();var tabPane;".( !empty( $tab ) ? "tabPane.setSelectedIndex( $tab );" : '' )."\n//]]></script>";
+ $ret .= '</div>';
+ } else {
+ $ret .= '<div class="tabpane">';
+ $ret .= $content;
+ $ret .= "<script type=\"text/javascript\">//<![CDATA[\nsetupAllTabs();var tabPane;\n//]]></script>";
+ $ret .= '</div>';
+ }
+
}
return $ret;
diff --git a/smarty_bit/function.formhelp.php b/smarty_bit/function.formhelp.php
index ef6e2bc..bffdded 100644
--- a/smarty_bit/function.formhelp.php
+++ b/smarty_bit/function.formhelp.php
@@ -50,7 +50,7 @@ function smarty_function_formhelp( $params, &$gBitSmarty ) {
$atts .= $key.'="'.$val.'" ';
}
break;
- }
+ }
}
if( !empty( $package ) ) {
diff --git a/templates/admin_banning.tpl b/templates/admin_banning.tpl
index f0034c2..c926b84 100644
--- a/templates/admin_banning.tpl
+++ b/templates/admin_banning.tpl
@@ -74,7 +74,7 @@
<tr>
<td><label for="banning-mess">{tr}Custom message to the user{/tr}</label></td>
<td>
- <textarea rows="4" cols="40" name="message">{$info.message|escape}</textarea>
+ <textarea rows="4" cols="50" name="message">{$info.message|escape}</textarea>
</td>
</tr>
<tr>
diff --git a/templates/admin_custom_modules.tpl b/templates/admin_custom_modules.tpl
index 9cc3350..bc6f3d9 100644
--- a/templates/admin_custom_modules.tpl
+++ b/templates/admin_custom_modules.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/Attic/admin_custom_modules.tpl,v 1.2 2005/08/07 17:38:46 squareing Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/Attic/admin_custom_modules.tpl,v 1.3 2005/10/29 17:53:55 squareing Exp $ *}
{strip}
<a name="editcreate"></a>
@@ -24,7 +24,7 @@
<div class="row">
{formlabel label="Data" for="usermoduledata"}
{forminput}
- <textarea id="usermoduledata" name="um_data" rows="10" cols="40">{$um_data|escape}</textarea>
+ <textarea id="usermoduledata" name="um_data" rows="10" cols="50">{$um_data|escape}</textarea>
{formhelp note=""}
{/forminput}
</div>
diff --git a/templates/admin_layout.tpl b/templates/admin_layout.tpl
index 909c3e1..d250531 100644
--- a/templates/admin_layout.tpl
+++ b/templates/admin_layout.tpl
@@ -98,6 +98,7 @@
{formlabel label="Module" for="module_rsrc"}
{forminput}
{html_options name="fAssign[module_rsrc]" id="module_rsrc" options=$all_modules selected=`$fAssign.name`}
+ {formhelp note="Extended help can be found at the end of this page."}
{/forminput}
</div>
{/if}
@@ -116,7 +117,7 @@
<div class="row">
{formlabel label="Title" for="title"}
{forminput}
- <input type="text" name="fAssign[title]" id="title" value="{$fAssign.title|escape}" />
+ <input type="text" size="48" name="fAssign[title]" id="title" value="{$fAssign.title|escape}" />
{formhelp note="Here you can override the default title used by the module. This is global for layouts in all sections. If you want to add a title just for one section, enter a module parameter below such as: title=My Title"}
{/forminput}
</div>
@@ -136,7 +137,7 @@
<div class="row">
{formlabel label="Cache Time" for="cache_time"}
{forminput}
- <input type="text" name="fAssign[cache_time]" id="cache_time" size="5" value="{$fAssign.cache_time|escape}" /> seconds
+ <input type="text" size="5" name="fAssign[cache_time]" id="cache_time" value="{$fAssign.cache_time|escape}" /> seconds
{formhelp note="This is the number of seconds the module is cached before the content is refreshed. The higher the value, the less load there is on the server. (optional)"}
{/forminput}
</div>
@@ -144,7 +145,7 @@
<div class="row">
{formlabel label="Rows" for="rows"}
{forminput}
- <input type="text" name="fAssign[rows]" id="rows" value="{$fAssign.rows|escape}" />
+ <input type="text" size="5" name="fAssign[rows]" id="rows" value="{$fAssign.rows|escape}" />
{formhelp note="Select what the maximum number of items are displayed. (optional - default is 10)"}
{/forminput}
</div>
@@ -152,7 +153,7 @@
<div class="row">
{formlabel label="Parameters" for="params"}
{forminput}
- <input type="text" name="fAssign[params]" id="params" value="{$fAssign.params|escape}" />
+ <input type="text" size="48" name="fAssign[params]" id="params" value="{$fAssign.params|escape}" />
{formhelp note="Here you can enter any additional parameters the module might need. Use the http query string form, e.g. foo=123&amp;bar=ABC (optional)"}
{/forminput}
</div>
@@ -238,7 +239,7 @@
<div class="row">
{formlabel label="Rows" for="c_rows"}
{forminput}
- <input type="text" name="fAssign[rows]" id="c_rows" value="{$fAssign.rows|escape}" />
+ <input type="text" size="5" name="fAssign[rows]" id="c_rows" value="{$fAssign.rows|escape}" />
{formhelp note="Select what the maximum number of items are displayed. (optional - default is 10)"}
{/forminput}
</div>
@@ -246,7 +247,7 @@
<div class="row">
{formlabel label="Parameters" for="c_params"}
{forminput}
- <input type="text" name="fAssign[params]" id="c_params" value="{$fAssign.params|escape}" />
+ <input type="text" size="48" name="fAssign[params]" id="c_params" value="{$fAssign.params|escape}" />
{formhelp note="Here you can enter any additional parameters the module might need. (optional)"}
{/forminput}
</div>
diff --git a/templates/admin_menus.tpl b/templates/admin_menus.tpl
index e84315b..2c63c52 100644
--- a/templates/admin_menus.tpl
+++ b/templates/admin_menus.tpl
@@ -1,9 +1,9 @@
{strip}
{jstabs}
{if $menu_id > 0}
- {assign var=title value="Edit Menu"}
+ {assign var=title value="Edit Menu"}
{else}
- {assign var=title value="Create Menu"}
+ {assign var=title value="Create Menu"}
{/if}
{jstab title=$title}
{if $menu_id > 0}
@@ -23,7 +23,7 @@
<div class="row">
{formlabel label="Description" for="menus_desc"}
{forminput}
- <textarea name="description" id="menus_desc" rows="4" cols="40">{$description|escape}</textarea>
+ <textarea name="description" id="menus_desc" rows="4" cols="50">{$description|escape}</textarea>
{formhelp note=""}
{/forminput}
</div>
diff --git a/templates/admin_server.tpl b/templates/admin_server.tpl
index b98937d..6d8935f 100644
--- a/templates/admin_server.tpl
+++ b/templates/admin_server.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/admin_server.tpl,v 1.4 2005/10/12 15:13:51 spiderr Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_kernel/templates/admin_server.tpl,v 1.5 2005/10/29 17:53:55 squareing Exp $ *}
{strip}
{form}
<input type="hidden" name="page" value="{$page}" />
@@ -34,7 +34,7 @@
<div class="row">
{formlabel label="Site Keywords" for="site_keywords"}
{forminput}
- <textarea cols="80" rows="5" name="site_keywords" id="site_keywords">{$gBitSystemPrefs.site_keywords|escape}</textarea>
+ <textarea cols="50" rows="5" name="site_keywords" id="site_keywords">{$gBitSystemPrefs.site_keywords|escape}</textarea>
{formhelp note="Keywords are used to tell search engines what your page is for. Based on these keywords, your site can be categorised better and searches will give you higher rankings.<br />The text you enter here will not be visible anywhere.<br />The Limit for search engines is <strong>900</strong> characters.<br />(due to db restrictions, this list of words will be cut off at 250 chars)."}
{/forminput}
</div>
diff --git a/templates/dynamic.tpl b/templates/dynamic.tpl
index f58e1f3..6e4f993 100644
--- a/templates/dynamic.tpl
+++ b/templates/dynamic.tpl
@@ -1,7 +1,7 @@
{section name=inc loop=$gCenterPieces}
-{include file=$gCenterPieces[inc]}
+ {include file=$gCenterPieces[inc]}
{sectionelse}
-{if $gDefaultCenter}
-{include file=$gDefaultCenter}
-{/if}
+ {if $gDefaultCenter}
+ {include file=$gDefaultCenter}
+ {/if}
{/section}
diff --git a/templates/error.tpl b/templates/error.tpl
index 532eed2..fb1ef45 100644
--- a/templates/error.tpl
+++ b/templates/error.tpl
@@ -1,11 +1,11 @@
{strip}
<div class="display errorpage">
<div class="header">
- <h1>{tr}Error{/tr}</h1>
+ <h1>{tr}Oops!{/tr}</h1>
</div>
<div class="body">
- {box title="An error has occurred"}
+ {box title="Seems there's been a minor glitch somewhere."}
<p class="highlight">{$msg}</p>
{if $template}
diff --git a/templates/header.tpl b/templates/header.tpl
index 4e7c273..3fa11c3 100644
--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -9,7 +9,13 @@
{include file=$file}
{/foreach}
</head>
-<body>
+<body
+ {if $gBodyOnload} onload="
+ {foreach from=$gBodyOnload item=loadString}
+ {$loadString}
+ {/foreach}"
+ {/if}
+>
<div style="display:none;position:absolute;top:0;left:-999em;"><a class="skip" style="position:absolute;top:0;left:-999em;width:0;height:0;" href="#content">{tr}Skip Navigation{/tr}</a></div>
{if $gBitSystem->isFeatureActive( 'feature_helppopup' )}
{popup_init src="`$smarty.const.THEMES_PKG_URL`js/overlib.js"}