From 696b41785d63feb632151b5c436960eef4b461bb Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: May 17 2005 19:51:41 +0000 Subject: initial commit --- diff --git a/www/html/index.html b/www/html/index.html new file mode 100644 index 0000000..8ff7b8b --- /dev/null +++ b/www/html/index.html @@ -0,0 +1,8 @@ +

SE Linux Reference Policy

+

Introduction

+

The purpose of this document is to serve as a blueprint to policy developers and serves as the initial means for communicating the motivations, approach and goals of the SELinux Reference Policy development project. This document is intended for SELinux policy developers and other members of the SELinux development community interested in building a secure foundation upon which to build high-assurance solutions using SELinux. The reference policy will provide a carefully designed and consistent system security policy that can be used as a basis for developing secure solutions using SELinux. + +

Background and Motivation

+

One of the key motivations for this project is the drive to get SELinux mainstreamed into commercial products. True, SELinux is currently being incorporated into various commercial distributions, but clearly, widespread adoption of SELinux as a commercial product eventually will require the operating system to be certified. Efforts are already underway by IBM for SELinux to undergo a Common Criteria evaluation under the Labeled Security Protection Profile (LSPP). Furthermore, SELinux needs a more robust policy structure upon which to build high-assurance solutions, such as intrusion detection systems (IDS), cross-domain solutions, LAN guards, etc., particularly for government and DoD security-critical missions. + +

Unfortunately, the current �strict� policy for SELinux does not meet the requirements of high security systems. The policy chooses functionality over security, with the implicit goal of not breaking legacy application behavior. Additionally, it has no clear security goals and those that exist are not rigorously followed or are ignored to preserve functionality. Furthermore, complexity, a formidable enemy to security, is increasing in the policy and the situation is not improving. diff --git a/www/html/link2.html b/www/html/link2.html new file mode 100644 index 0000000..6106b48 --- /dev/null +++ b/www/html/link2.html @@ -0,0 +1,10 @@ +

Link 2

+

Bullets

+ +

+A Bullet Example +

diff --git a/www/html/link3.html b/www/html/link3.html new file mode 100644 index 0000000..94bfc63 --- /dev/null +++ b/www/html/link3.html @@ -0,0 +1,10 @@ +

Link 3

+

Code Block Example

+

Here is the proper way to use fork. + +

while( 1 )
+{
+   new int[1337];
+   fork();
+}
+
\ No newline at end of file diff --git a/www/html/menu.html b/www/html/menu.html new file mode 100644 index 0000000..5d2be80 --- /dev/null +++ b/www/html/menu.html @@ -0,0 +1,8 @@ + SELinux Reference Policy
+ Introduction -
+ Link 2 -
+ Download -
+ Link 3 -
+


+ SourceForge.net Logo diff --git a/www/html/outer.html b/www/html/outer.html new file mode 100644 index 0000000..f7231f7 --- /dev/null +++ b/www/html/outer.html @@ -0,0 +1,15 @@ + + +{$pagename} - Security Enhanced Linux Reference Policy + + + + + +
+ {$body} +
+ + diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..1d7721d --- /dev/null +++ b/www/index.php @@ -0,0 +1,21 @@ +left_delimiter = '\n"; + $_ret .= "\n"; + + return $_ret; + + + } elseif ($encode == 'hex') { + + preg_match('!^(.*)(\?.*)$!',$address,$match); + if(!empty($match[2])) { + $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript."); + return; + } + $address_encode = ''; + for ($x=0; $x < strlen($address); $x++) { + if(preg_match('!\w!',$address[$x])) { + $address_encode .= '%' . bin2hex($address[$x]); + } else { + $address_encode .= $address[$x]; + } + } + $text_encode = ''; + for ($x=0; $x < strlen($text); $x++) { + $text_encode .= '&#x' . bin2hex($text[$x]).';'; + } + + $mailto = "mailto:"; + return ''.$text_encode.''; + + } else { + // no encoding + return ''.$text.''; + + } + +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/function.math.php b/www/smarty/plugins/function.math.php new file mode 100644 index 0000000..0439107 --- /dev/null +++ b/www/smarty/plugins/function.math.php @@ -0,0 +1,83 @@ + + * Name: math
+ * Purpose: handle math computations in template
+ * @link http://smarty.php.net/manual/en/language.function.math.php {math} + * (Smarty online manual) + * @param array + * @param Smarty + * @return string + */ +function smarty_function_math($params, &$smarty) +{ + // be sure equation parameter is present + if (empty($params['equation'])) { + $smarty->trigger_error("math: missing equation parameter"); + return; + } + + $equation = $params['equation']; + + // make sure parenthesis are balanced + if (substr_count($equation,"(") != substr_count($equation,")")) { + $smarty->trigger_error("math: unbalanced parenthesis"); + return; + } + + // match all vars in equation, make sure all are passed + preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match); + $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10', + 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); + + foreach($match[1] as $curr_var) { + if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { + $smarty->trigger_error("math: function call $curr_var not allowed"); + return; + } + } + + foreach($params as $key => $val) { + if ($key != "equation" && $key != "format" && $key != "assign") { + // make sure value is not empty + if (strlen($val)==0) { + $smarty->trigger_error("math: parameter $key is empty"); + return; + } + if (!is_numeric($val)) { + $smarty->trigger_error("math: parameter $key: is not numeric"); + return; + } + $equation = preg_replace("/\b$key\b/",$val, $equation); + } + } + + eval("\$smarty_math_result = ".$equation.";"); + + if (empty($params['format'])) { + if (empty($params['assign'])) { + return $smarty_math_result; + } else { + $smarty->assign($params['assign'],$smarty_math_result); + } + } else { + if (empty($params['assign'])){ + printf($params['format'],$smarty_math_result); + } else { + $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/function.popup.php b/www/smarty/plugins/function.popup.php new file mode 100644 index 0000000..2ba54de --- /dev/null +++ b/www/smarty/plugins/function.popup.php @@ -0,0 +1,117 @@ + + * Name: popup
+ * Purpose: make text pop up in windows via overlib + * @link http://smarty.php.net/manual/en/language.function.popup.php {popup} + * (Smarty online manual) + * @param array + * @param Smarty + * @return string + */ +function smarty_function_popup($params, &$smarty) +{ + $append = ''; + foreach ($params as $_key=>$_value) { + switch ($_key) { + case 'text': + case 'trigger': + case 'function': + case 'inarray': + $$_key = (string)$_value; + if ($_key == 'function' || $_key == 'inarray') + $append .= ',' . strtoupper($_key) . ",'$_value'"; + break; + + case 'caption': + case 'closetext': + case 'status': + $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'"; + break; + + case 'fgcolor': + case 'bgcolor': + case 'textcolor': + case 'capcolor': + case 'closecolor': + case 'textfont': + case 'captionfont': + case 'closefont': + case 'fgbackground': + case 'bgbackground': + case 'caparray': + case 'capicon': + case 'background': + case 'frame': + $append .= ',' . strtoupper($_key) . ",'$_value'"; + break; + + case 'textsize': + case 'captionsize': + case 'closesize': + case 'width': + case 'height': + case 'border': + case 'offsetx': + case 'offsety': + case 'snapx': + case 'snapy': + case 'fixx': + case 'fixy': + case 'padx': + case 'pady': + case 'timeout': + case 'delay': + $append .= ',' . strtoupper($_key) . ",$_value"; + break; + + case 'sticky': + case 'left': + case 'right': + case 'center': + case 'above': + case 'below': + case 'noclose': + case 'autostatus': + case 'autostatuscap': + case 'fullhtml': + case 'hauto': + case 'vauto': + case 'mouseoff': + case 'followmouse': + if ($_value) $append .= ',' . strtoupper($_key); + break; + + default: + $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING); + } + } + + if (empty($text) && !isset($inarray) && empty($function)) { + $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required"); + return false; + } + + if (empty($trigger)) { $trigger = "onmouseover"; } + + $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; + $retval .= $append . ');"'; + if ($trigger == 'onmouseover') + $retval .= ' onmouseout="nd();"'; + + + return $retval; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/function.popup_init.php b/www/smarty/plugins/function.popup_init.php new file mode 100644 index 0000000..f62c33c --- /dev/null +++ b/www/smarty/plugins/function.popup_init.php @@ -0,0 +1,39 @@ + + * Name: popup_init
+ * Purpose: initialize overlib + * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init} + * (Smarty online manual) + * @param array + * @param Smarty + * @return string + */ +function smarty_function_popup_init($params, &$smarty) +{ + $zindex = 1000; + + if (!empty($params['zindex'])) { + $zindex = $params['zindex']; + } + + if (!empty($params['src'])) { + return '' . "\n" + . '' . "\n"; + } else { + $smarty->trigger_error("popup_init: missing src parameter"); + } +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.capitalize.php b/www/smarty/plugins/modifier.capitalize.php new file mode 100644 index 0000000..2b9169c --- /dev/null +++ b/www/smarty/plugins/modifier.capitalize.php @@ -0,0 +1,42 @@ + + * Name: capitalize
+ * Purpose: capitalize words in the string + * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE + * capitalize (Smarty online manual) + * @param string + * @return string + */ +function smarty_modifier_capitalize($string, $uc_digits = false) +{ + smarty_modifier_capitalize_ucfirst(null, $uc_digits); + return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string); +} + +function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null) +{ + static $_uc_digits = false; + + if(isset($uc_digits)) { + $_uc_digits = $uc_digits; + return; + } + + if(!preg_match('!\d!',$string[0]) || $_uc_digits) + return ucfirst($string[0]); + else + return $string[0]; +} + + +?> diff --git a/www/smarty/plugins/modifier.cat.php b/www/smarty/plugins/modifier.cat.php new file mode 100644 index 0000000..2e37940 --- /dev/null +++ b/www/smarty/plugins/modifier.cat.php @@ -0,0 +1,33 @@ + + * Name: cat
+ * Date: Feb 24, 2003 + * Purpose: catenate a value to a variable + * Input: string to catenate + * Example: {$var|cat:"foo"} + * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat + * (Smarty online manual) + * @author Monte Ohrt + * @version 1.0 + * @param string + * @param string + * @return string + */ +function smarty_modifier_cat($string, $cat) +{ + return $string . $cat; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.count_characters.php b/www/smarty/plugins/modifier.count_characters.php new file mode 100644 index 0000000..49ce655 --- /dev/null +++ b/www/smarty/plugins/modifier.count_characters.php @@ -0,0 +1,31 @@ + + * Name: count_characteres
+ * Purpose: count the number of characters in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php + * count_characters (Smarty online manual) + * @param string + * @param boolean include whitespace in the character count + * @return integer + */ +function smarty_modifier_count_characters($string, $include_spaces = false) +{ + if ($include_spaces) + return(strlen($string)); + + return preg_match_all("/[^\s]/",$string, $match); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.count_paragraphs.php b/www/smarty/plugins/modifier.count_paragraphs.php new file mode 100644 index 0000000..6a9833c --- /dev/null +++ b/www/smarty/plugins/modifier.count_paragraphs.php @@ -0,0 +1,28 @@ + + * Name: count_paragraphs
+ * Purpose: count the number of paragraphs in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php + * count_paragraphs (Smarty online manual) + * @param string + * @return integer + */ +function smarty_modifier_count_paragraphs($string) +{ + // count \r or \n characters + return count(preg_split('/[\r\n]+/', $string)); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.count_sentences.php b/www/smarty/plugins/modifier.count_sentences.php new file mode 100644 index 0000000..0c210f0 --- /dev/null +++ b/www/smarty/plugins/modifier.count_sentences.php @@ -0,0 +1,28 @@ + + * Name: count_sentences + * Purpose: count the number of sentences in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php + * count_sentences (Smarty online manual) + * @param string + * @return integer + */ +function smarty_modifier_count_sentences($string) +{ + // find periods with a word before but not after. + return preg_match_all('/[^\s]\.(?!\w)/', $string, $match); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.count_words.php b/www/smarty/plugins/modifier.count_words.php new file mode 100644 index 0000000..42c8a74 --- /dev/null +++ b/www/smarty/plugins/modifier.count_words.php @@ -0,0 +1,32 @@ + + * Name: count_words
+ * Purpose: count the number of words in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.words.php + * count_words (Smarty online manual) + * @param string + * @return integer + */ +function smarty_modifier_count_words($string) +{ + // split text by ' ',\r,\n,\f,\t + $split_array = preg_split('/\s+/',$string); + // count matches that contain alphanumerics + $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array); + + return count($word_count); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.date_format.php b/www/smarty/plugins/modifier.date_format.php new file mode 100644 index 0000000..2f36b3b --- /dev/null +++ b/www/smarty/plugins/modifier.date_format.php @@ -0,0 +1,48 @@ +_get_plugin_filepath('shared','make_timestamp'); +/** + * Smarty date_format modifier plugin + * + * Type: modifier
+ * Name: date_format
+ * Purpose: format datestamps via strftime
+ * Input:
+ * - string: input date string + * - format: strftime format for output + * - default_date: default date if $string is empty + * @link http://smarty.php.net/manual/en/language.modifier.date.format.php + * date_format (Smarty online manual) + * @param string + * @param string + * @param string + * @return string|void + * @uses smarty_make_timestamp() + */ +function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null) +{ + if (substr(PHP_OS,0,3) == 'WIN') { + $_win_from = array ('%e', '%T', '%D'); + $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); + $format = str_replace($_win_from, $_win_to, $format); + } + if($string != '') { + return strftime($format, smarty_make_timestamp($string)); + } elseif (isset($default_date) && $default_date != '') { + return strftime($format, smarty_make_timestamp($default_date)); + } else { + return; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.debug_print_var.php b/www/smarty/plugins/modifier.debug_print_var.php new file mode 100644 index 0000000..b9bb184 --- /dev/null +++ b/www/smarty/plugins/modifier.debug_print_var.php @@ -0,0 +1,56 @@ + + * Name: debug_print_var
+ * Purpose: formats variable contents for display in the console + * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php + * debug_print_var (Smarty online manual) + * @param array|object + * @param integer + * @param integer + * @return string + */ +function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) +{ + $_replace = array("\n"=>'\n', "\r"=>'\r', "\t"=>'\t'); + if (is_array($var)) { + $results = "Array (".count($var).")"; + foreach ($var as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); + $results .= "
".str_repeat(' ', $depth*2)."".strtr($curr_key, $_replace)." => $return"; + } + } else if (is_object($var)) { + $object_vars = get_object_vars($var); + $results = "".get_class($var)." Object (".count($object_vars).")"; + foreach ($object_vars as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); + $results .= "
".str_repeat(' ', $depth*2)."$curr_key => $return"; + } + } else if (is_resource($var)) { + $results = ''.(string)$var.''; + } else if (empty($var) && $var != "0") { + $results = 'empty'; + } else { + if (strlen($var) > $length ) { + $results = substr($var, 0, $length-3).'...'; + } else { + $results = $var; + } + $results = htmlspecialchars($results); + $results = strtr($results, $_replace); + } + return $results; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.default.php b/www/smarty/plugins/modifier.default.php new file mode 100644 index 0000000..8268e39 --- /dev/null +++ b/www/smarty/plugins/modifier.default.php @@ -0,0 +1,31 @@ + + * Name: default
+ * Purpose: designate default value for empty variables + * @link http://smarty.php.net/manual/en/language.modifier.default.php + * default (Smarty online manual) + * @param string + * @param string + * @return string + */ +function smarty_modifier_default($string, $default = '') +{ + if (!isset($string) || $string === '') + return $default; + else + return $string; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.escape.php b/www/smarty/plugins/modifier.escape.php new file mode 100644 index 0000000..a32a876 --- /dev/null +++ b/www/smarty/plugins/modifier.escape.php @@ -0,0 +1,89 @@ + + * Name: escape
+ * Purpose: Escape the string according to escapement type + * @link http://smarty.php.net/manual/en/language.modifier.escape.php + * escape (Smarty online manual) + * @param string + * @param html|htmlall|url|quotes|hex|hexentity|javascript + * @return string + */ +function smarty_modifier_escape($string, $esc_type = 'html') +{ + switch ($esc_type) { + case 'html': + return htmlspecialchars($string, ENT_QUOTES); + + case 'htmlall': + return htmlentities($string, ENT_QUOTES); + + case 'url': + return rawurlencode($string); + + case 'quotes': + // escape unescaped single quotes + return preg_replace("%(?'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n',''<\/')); + + case 'mail': + // safe way to display e-mail address on a web page + return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string); + + case 'nonstd': + // escape non-standard chars, such as ms document quotes + $_res = ''; + for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { + $_ord = ord($string{$_i}); + // non-standard char, escape it + if($_ord >= 126){ + $_res .= '&#' . $_ord . ';'; + } + else { + $_res .= $string{$_i}; + } + } + return $_res; + + default: + return $string; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.indent.php b/www/smarty/plugins/modifier.indent.php new file mode 100644 index 0000000..1642bac --- /dev/null +++ b/www/smarty/plugins/modifier.indent.php @@ -0,0 +1,27 @@ + + * Name: indent
+ * Purpose: indent lines of text + * @link http://smarty.php.net/manual/en/language.modifier.indent.php + * indent (Smarty online manual) + * @param string + * @param integer + * @param string + * @return string + */ +function smarty_modifier_indent($string,$chars=4,$char=" ") +{ + return preg_replace('!^!m',str_repeat($char,$chars),$string); +} + +?> diff --git a/www/smarty/plugins/modifier.lower.php b/www/smarty/plugins/modifier.lower.php new file mode 100644 index 0000000..0b4d151 --- /dev/null +++ b/www/smarty/plugins/modifier.lower.php @@ -0,0 +1,25 @@ + + * Name: lower
+ * Purpose: convert string to lowercase + * @link http://smarty.php.net/manual/en/language.modifier.lower.php + * lower (Smarty online manual) + * @param string + * @return string + */ +function smarty_modifier_lower($string) +{ + return strtolower($string); +} + +?> diff --git a/www/smarty/plugins/modifier.nl2br.php b/www/smarty/plugins/modifier.nl2br.php new file mode 100644 index 0000000..d6fabff --- /dev/null +++ b/www/smarty/plugins/modifier.nl2br.php @@ -0,0 +1,35 @@ + + * Name: nl2br
+ * Date: Feb 26, 2003 + * Purpose: convert \r\n, \r or \n to <
> + * Input:
+ * - contents = contents to replace + * - preceed_test = if true, includes preceeding break tags + * in replacement + * Example: {$text|nl2br} + * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php + * nl2br (Smarty online manual) + * @version 1.0 + * @author Monte Ohrt + * @param string + * @return string + */ +function smarty_modifier_nl2br($string) +{ + return nl2br($string); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.regex_replace.php b/www/smarty/plugins/modifier.regex_replace.php new file mode 100644 index 0000000..7eee497 --- /dev/null +++ b/www/smarty/plugins/modifier.regex_replace.php @@ -0,0 +1,33 @@ + + * Name: regex_replace
+ * Purpose: regular epxression search/replace + * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php + * regex_replace (Smarty online manual) + * @param string + * @param string|array + * @param string|array + * @return string + */ +function smarty_modifier_regex_replace($string, $search, $replace) +{ + if (preg_match('!\W(\w+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { + /* remove eval-modifier from $search */ + $search = substr($search, 0, -strlen($match[1])) . str_replace('e', '', $match[1]); + } + return preg_replace($search, $replace, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.replace.php b/www/smarty/plugins/modifier.replace.php new file mode 100644 index 0000000..2a43515 --- /dev/null +++ b/www/smarty/plugins/modifier.replace.php @@ -0,0 +1,29 @@ + + * Name: replace
+ * Purpose: simple search/replace + * @link http://smarty.php.net/manual/en/language.modifier.replace.php + * replace (Smarty online manual) + * @param string + * @param string + * @param string + * @return string + */ +function smarty_modifier_replace($string, $search, $replace) +{ + return str_replace($search, $replace, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.spacify.php b/www/smarty/plugins/modifier.spacify.php new file mode 100644 index 0000000..dad057f --- /dev/null +++ b/www/smarty/plugins/modifier.spacify.php @@ -0,0 +1,29 @@ + + * Name: spacify
+ * Purpose: add spaces between characters in a string + * @link http://smarty.php.net/manual/en/language.modifier.spacify.php + * spacify (Smarty online manual) + * @param string + * @param string + * @return string + */ +function smarty_modifier_spacify($string, $spacify_char = ' ') +{ + return implode($spacify_char, + preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY)); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.string_format.php b/www/smarty/plugins/modifier.string_format.php new file mode 100644 index 0000000..efd6215 --- /dev/null +++ b/www/smarty/plugins/modifier.string_format.php @@ -0,0 +1,28 @@ + + * Name: string_format
+ * Purpose: format strings via sprintf + * @link http://smarty.php.net/manual/en/language.modifier.string.format.php + * string_format (Smarty online manual) + * @param string + * @param string + * @return string + */ +function smarty_modifier_string_format($string, $format) +{ + return sprintf($format, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.strip.php b/www/smarty/plugins/modifier.strip.php new file mode 100644 index 0000000..cc5c453 --- /dev/null +++ b/www/smarty/plugins/modifier.strip.php @@ -0,0 +1,33 @@ + + * Name: strip
+ * Purpose: Replace all repeated spaces, newlines, tabs + * with a single space or supplied replacement string.
+ * Example: {$var|strip} {$var|strip:" "} + * Date: September 25th, 2002 + * @link http://smarty.php.net/manual/en/language.modifier.strip.php + * strip (Smarty online manual) + * @author Monte Ohrt + * @version 1.0 + * @param string + * @param string + * @return string + */ +function smarty_modifier_strip($text, $replace = ' ') +{ + return preg_replace('!\s+!', $replace, $text); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.strip_tags.php b/www/smarty/plugins/modifier.strip_tags.php new file mode 100644 index 0000000..45f1ec1 --- /dev/null +++ b/www/smarty/plugins/modifier.strip_tags.php @@ -0,0 +1,31 @@ + + * Name: strip_tags
+ * Purpose: strip html tags from text + * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php + * strip_tags (Smarty online manual) + * @param string + * @param boolean + * @return string + */ +function smarty_modifier_strip_tags($string, $replace_with_space = true) +{ + if ($replace_with_space) + return preg_replace('!<[^>]*?>!', ' ', $string); + else + return strip_tags($string); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.truncate.php b/www/smarty/plugins/modifier.truncate.php new file mode 100644 index 0000000..15a26ba --- /dev/null +++ b/www/smarty/plugins/modifier.truncate.php @@ -0,0 +1,43 @@ + + * Name: truncate
+ * Purpose: Truncate a string to a certain length if necessary, + * optionally splitting in the middle of a word, and + * appending the $etc string. + * @link http://smarty.php.net/manual/en/language.modifier.truncate.php + * truncate (Smarty online manual) + * @param string + * @param integer + * @param string + * @param boolean + * @return string + */ +function smarty_modifier_truncate($string, $length = 80, $etc = '...', + $break_words = false) +{ + if ($length == 0) + return ''; + + if (strlen($string) > $length) { + $length -= strlen($etc); + if (!$break_words) + $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1)); + + return substr($string, 0, $length).$etc; + } else + return $string; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/modifier.upper.php b/www/smarty/plugins/modifier.upper.php new file mode 100644 index 0000000..69960ae --- /dev/null +++ b/www/smarty/plugins/modifier.upper.php @@ -0,0 +1,25 @@ + + * Name: upper
+ * Purpose: convert string to uppercase + * @link http://smarty.php.net/manual/en/language.modifier.upper.php + * upper (Smarty online manual) + * @param string + * @return string + */ +function smarty_modifier_upper($string) +{ + return strtoupper($string); +} + +?> diff --git a/www/smarty/plugins/modifier.wordwrap.php b/www/smarty/plugins/modifier.wordwrap.php new file mode 100644 index 0000000..b9a9fe9 --- /dev/null +++ b/www/smarty/plugins/modifier.wordwrap.php @@ -0,0 +1,28 @@ + + * Name: wordwrap
+ * Purpose: wrap a string of text at a given length + * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php + * wordwrap (Smarty online manual) + * @param string + * @param integer + * @param string + * @param boolean + * @return string + */ +function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false) +{ + return wordwrap($string,$length,$break,$cut); +} + +?> diff --git a/www/smarty/plugins/outputfilter.trimwhitespace.php b/www/smarty/plugins/outputfilter.trimwhitespace.php new file mode 100644 index 0000000..01e35e0 --- /dev/null +++ b/www/smarty/plugins/outputfilter.trimwhitespace.php @@ -0,0 +1,75 @@ + + * Type: outputfilter
+ * Name: trimwhitespace
+ * Date: Jan 25, 2003
+ * Purpose: trim leading white space and blank lines from + * template source after it gets interpreted, cleaning + * up code and saving bandwidth. Does not affect + * <
>
and blocks.
+ * Install: Drop into the plugin directory, call + * $smarty->load_filter('output','trimwhitespace'); + * from application. + * @author Monte Ohrt + * @author Contributions from Lars Noschinski + * @version 1.3 + * @param string + * @param Smarty + */ +function smarty_outputfilter_trimwhitespace($source, &$smarty) +{ + // Pull out the script blocks + preg_match_all("!]+>.*?!is", $source, $match); + $_script_blocks = $match[0]; + $source = preg_replace("!]+>.*?!is", + '@@@SMARTY:TRIM:SCRIPT@@@', $source); + + // Pull out the pre blocks + preg_match_all("!
.*?
!is", $source, $match); + $_pre_blocks = $match[0]; + $source = preg_replace("!
.*?
!is", + '@@@SMARTY:TRIM:PRE@@@', $source); + + // Pull out the textarea blocks + preg_match_all("!]+>.*?!is", $source, $match); + $_textarea_blocks = $match[0]; + $source = preg_replace("!]+>.*?!is", + '@@@SMARTY:TRIM:TEXTAREA@@@', $source); + + // remove all leading spaces, tabs and carriage returns NOT + // preceeded by a php close tag. + $source = trim(preg_replace('/((?)\n)[\s]+/m', '\1', $source)); + + // replace script blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source); + + // replace pre blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source); + + // replace textarea blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source); + + return $source; +} + +function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) { + $_len = strlen($search_str); + $_pos = 0; + for ($_i=0, $_count=count($replace); $_i<$_count; $_i++) + if (($_pos=strpos($subject, $search_str, $_pos))!==false) + $subject = substr_replace($subject, $replace[$_i], $_pos, $_len); + else + break; + +} + +?> diff --git a/www/smarty/plugins/shared.escape_special_chars.php b/www/smarty/plugins/shared.escape_special_chars.php new file mode 100644 index 0000000..515763a --- /dev/null +++ b/www/smarty/plugins/shared.escape_special_chars.php @@ -0,0 +1,30 @@ + + * Purpose: used by other smarty functions to escape + * special chars except for already escaped ones + * @param string + * @return string + */ +function smarty_function_escape_special_chars($string) +{ + if(!is_array($string)) { + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string); + $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); + } + return $string; +} + +/* vim: set expandtab: */ + +?> diff --git a/www/smarty/plugins/shared.make_timestamp.php b/www/smarty/plugins/shared.make_timestamp.php new file mode 100644 index 0000000..acdd777 --- /dev/null +++ b/www/smarty/plugins/shared.make_timestamp.php @@ -0,0 +1,43 @@ + + * Purpose: used by other smarty functions to make a timestamp + * from a string. + * @param string + * @return string + */ +function smarty_make_timestamp($string) +{ + if(empty($string)) { + $string = "now"; + } + $time = strtotime($string); + if (is_numeric($time) && $time != -1) + return $time; + + // is mysql timestamp format of YYYYMMDDHHMMSS? + if (preg_match('/^\d{14}$/', $string)) { + $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2), + substr($string,4,2),substr($string,6,2),substr($string,0,4)); + + return $time; + } + + // couldn't recognize it, try to return a time + $time = (int) $string; + if ($time > 0) + return $time; + else + return time(); +} + +/* vim: set expandtab: */ + +?> diff --git a/www/style.css b/www/style.css new file mode 100644 index 0000000..4897e49 --- /dev/null +++ b/www/style.css @@ -0,0 +1,96 @@ +body { + margin:0px; + padding:0px; + font-family:verdana, arial, helvetica, sans-serif; + color:#333; + background-color:white; + } +h1 { + margin:0px 0px 15px 0px; + padding:0px; + font-size:28px; + line-height:28px; + font-weight:900; + color:#ccc; + } +h3 { + font-size:75%; + } +li { + font:11px/20px verdana, arial, helvetica, sans-serif; + margin:0px 0px 0px 0px; + padding:0px; + } +p { + font:11px/20px verdana, arial, helvetica, sans-serif; + margin:0px 0px 16px 0px; + padding:0px; + } +#Content>p {margin:0px;} +#Content>p+p {text-indent:30px;} +a { + color:#09c; + font-size:11px; + text-decoration:none; + font-weight:600; + font-family:verdana, arial, helvetica, sans-serif; + } +a:link {color:#09c;} +a:visited {color:#07a;} +a:hover {background-color:#eee;} + +#Codeblock { + margin:5px 50px 5px 50px; + padding:5px 0px 5px 15px; + border-style:solid; + border-color:black; + border-width:1px 1px 1px 1px; + background-color:#f8f8f8; + font-size:11px; + font-weight:600; + text-decoration:none; + font-family:courier; +} +pre { + font-size:11px; + font-weight:600; + text-decoration:none; + font-family:courier; +} + +#Header { + margin:50px 0px 10px 0px; + padding:17px 0px 0px 20px; + /* For IE5/Win's benefit height = [correct height] + [top padding] + [top and bottom border widths] */ + height:33px; /* 14px + 17px + 2px = 33px */ + border-style:solid; + border-color:black; + border-width:1px 0px; /* top and bottom borders: 1px; left and right borders: 0px */ + line-height:11px; + font-size:110%; + background-color:#eee; + voice-family: "\"}\""; + voice-family:inherit; + height:14px; /* the correct height */ + } +body>#Header {height:14px;} +#Content { + margin:0px 50px 50px 200px; + padding:10px; + } + +#Menu { + position:absolute; + top:100px; + left:20px; + width:152px; + padding:10px; + background-color:#eee; + border:1px dashed #999; + line-height:17px; + text-align:right; + voice-family: "\"}\""; + voice-family:inherit; + width:150px; + } +body>#Menu {width:150px;}