Commit dfcbe080 authored by lrargerich's avatar lrargerich

This commit was generated by cvs2svn to compensate for changes in r4,

which included commits to RCS files with non-trunk default branches.
parent 79d6ca53
* text=auto !eol
tiki/Smarty/.cvsignore -text
tiki/Smarty/AUTHORS -text
tiki/Smarty/BUGS -text
tiki/Smarty/COPYING.lib -text
tiki/Smarty/CREDITS -text
tiki/Smarty/ChangeLog -text
tiki/Smarty/Config_File.class.php -text
tiki/Smarty/FAQ -text
tiki/Smarty/INSTALL -text
tiki/Smarty/NEWS -text
tiki/Smarty/QUICKSTART -text
tiki/Smarty/README -text
tiki/Smarty/RELEASE_NOTES -text
tiki/Smarty/RESOURCES -text
tiki/Smarty/Smarty.class.php -text
tiki/Smarty/Smarty_Compiler.class.php -text
tiki/Smarty/TESTIMONIALS -text
tiki/Smarty/TODO -text
tiki/Smarty/debug.tpl -text
tiki/Smarty/index.php -text
tiki/Smarty/misc/fix_vars.php -text
tiki/Smarty/plugins/block.tr.php -text
tiki/Smarty/plugins/calendar.tpl -text
tiki/Smarty/plugins/function.assign.php -text
tiki/Smarty/plugins/function.assign_debug_info.php -text
tiki/Smarty/plugins/function.counter.php -text
tiki/Smarty/plugins/function.cycle.php -text
tiki/Smarty/plugins/function.debug.php -text
tiki/Smarty/plugins/function.eval.php -text
tiki/Smarty/plugins/function.fetch.php -text
tiki/Smarty/plugins/function.html_options.php -text
tiki/Smarty/plugins/function.html_select_date.php -text
tiki/Smarty/plugins/function.html_select_time.php -text
tiki/Smarty/plugins/function.math.php -text
tiki/Smarty/plugins/function.popup.php -text
tiki/Smarty/plugins/function.popup_init.php -text
tiki/Smarty/plugins/modifier.capitalize.php -text
tiki/Smarty/plugins/modifier.count_characters.php -text
tiki/Smarty/plugins/modifier.count_paragraphs.php -text
tiki/Smarty/plugins/modifier.count_sentences.php -text
tiki/Smarty/plugins/modifier.count_words.php -text
tiki/Smarty/plugins/modifier.date_format.php -text
tiki/Smarty/plugins/modifier.debug_print_var.php -text
tiki/Smarty/plugins/modifier.default.php -text
tiki/Smarty/plugins/modifier.escape.php -text
tiki/Smarty/plugins/modifier.indent.php -text
tiki/Smarty/plugins/modifier.lower.php -text
tiki/Smarty/plugins/modifier.regex_replace.php -text
tiki/Smarty/plugins/modifier.replace.php -text
tiki/Smarty/plugins/modifier.spacify.php -text
tiki/Smarty/plugins/modifier.string_format.php -text
tiki/Smarty/plugins/modifier.strip_tags.php -text
tiki/Smarty/plugins/modifier.truncate.php -text
tiki/Smarty/plugins/modifier.upper.php -text
tiki/Smarty/plugins/modifier.wordwrap.php -text
tiki/Smarty/plugins/shared.make_timestamp.php -text
tiki/db/tiki-db.php -text
tiki/db/tiki.sql -text
tiki/doc/tiki09.doc -text
tiki/doc/tiki09.pdf -text
tiki/dump/new.tar -text
tiki/get_strings.php -text
tiki/img/css.gif -text
tiki/img/css1.png -text
tiki/img/html.png -text
tiki/img/mysql.gif -text
tiki/img/php.gif -text
tiki/img/rss.png -text
tiki/img/smarty.gif -text
tiki/img/tiki.jpg -text
tiki/index.php -text
tiki/lang/en/language.php -text
tiki/lang/en/old.php -text
tiki/lang/language.php -text
tiki/lang/old.php -text
tiki/lang/sp/language.php -text
tiki/lang/sp/old.php -text
tiki/lib/class.ezpdf.php.exe -text
tiki/lib/class_calendar.php -text
tiki/lib/tar.class.php -text
tiki/lib/tikilib.php -text
tiki/lib/userslib.php -text
tiki/modules/cache/mod-Oso.tpl.cache -text
tiki/modules/cache/mod-Un[!!-~]pato.tpl.cache -text
tiki/modules/cache/mod-admin_menu.tpl.cache -text
tiki/modules/cache/mod-application_menu.tpl.cache -text
tiki/modules/cache/mod-calendar.tpl.cache -text
tiki/modules/cache/mod-dada.tpl.cache -text
tiki/modules/cache/mod-featured_links.tpl.cache -text
tiki/modules/cache/mod-last_galleries.tpl.cache -text
tiki/modules/cache/mod-last_modif.tpl.cache -text
tiki/modules/cache/mod-logged_users.tpl.cache -text
tiki/modules/cache/mod-login_box.tpl.cache -text
tiki/modules/cache/mod-logo.tpl.cache -text
tiki/modules/cache/mod-prueb.tpl.cache -text
tiki/modules/cache/mod-search_box.tpl.cache -text
tiki/modules/cache/mod-top_galleries.tpl.cache -text
tiki/modules/cache/mod-top_images.tpl.cache -text
tiki/modules/cache/mod-top_images_th.tpl.cache -text
tiki/modules/cache/mod-top_pages.tpl.cache -text
tiki/modules/cache/mod-user_galleries.tpl.cache -text
tiki/modules/cache/mod-user_pages.tpl.cache -text
tiki/modules/mod-featured_links.php -text
tiki/modules/mod-last_galleries.php -text
tiki/modules/mod-last_modif.php -text
tiki/modules/mod-logged_users.php -text
tiki/modules/mod-top_galleries.php -text
tiki/modules/mod-top_images.php -text
tiki/modules/mod-top_images_th.php -text
tiki/modules/mod-top_pages.php -text
tiki/modules/mod-user_galleries.php -text
tiki/modules/mod-user_pages.php -text
tiki/setup.php -text
tiki/show_image.php -text
tiki/styles/default.css -text
tiki/styles/tiki.css -text
tiki/templates/error.tpl -text
tiki/templates/footer.tpl -text
tiki/templates/header.tpl -text
tiki/templates/modules/mod-admin_menu.tpl -text
tiki/templates/modules/mod-application_menu.tpl -text
tiki/templates/modules/mod-calendar.tpl -text
tiki/templates/modules/mod-calendar.tpl.nocache -text
tiki/templates/modules/mod-featured_links.tpl -text
tiki/templates/modules/mod-last_galleries.tpl -text
tiki/templates/modules/mod-last_modif.tpl -text
tiki/templates/modules/mod-logged_users.tpl -text
tiki/templates/modules/mod-login_box.tpl -text
tiki/templates/modules/mod-login_box.tpl.nocache -text
tiki/templates/modules/mod-logo.tpl -text
tiki/templates/modules/mod-search_box.tpl -text
tiki/templates/modules/mod-top_galleries.tpl -text
tiki/templates/modules/mod-top_images.tpl -text
tiki/templates/modules/mod-top_images_th.tpl -text
tiki/templates/modules/mod-top_pages.tpl -text
tiki/templates/modules/mod-user_galleries.tpl -text
tiki/templates/modules/mod-user_galleries.tpl.nocache -text
tiki/templates/modules/mod-user_pages.php.nocache -text
tiki/templates/modules/mod-user_pages.tpl -text
tiki/templates/modules/mod-user_pages.tpl.nocache -text
tiki/templates/modules/user_module.tpl -text
tiki/templates/tiki-admin.tpl -text
tiki/templates/tiki-admin_links.tpl -text
tiki/templates/tiki-admin_modules.tpl -text
tiki/templates/tiki-admingroups.tpl -text
tiki/templates/tiki-adminusers.tpl -text
tiki/templates/tiki-adminusers_old.tpl -text
tiki/templates/tiki-app_bar.tpl -text
tiki/templates/tiki-assignpermission.tpl -text
tiki/templates/tiki-assignuser.tpl -text
tiki/templates/tiki-backlinks.tpl -text
tiki/templates/tiki-bot_bar.tpl -text
tiki/templates/tiki-browse_gallery.tpl -text
tiki/templates/tiki-browse_gallery_theme.tpl -text
tiki/templates/tiki-browse_image.tpl -text
tiki/templates/tiki-editpage.tpl -text
tiki/templates/tiki-featured_link.tpl -text
tiki/templates/tiki-galleries.tpl -text
tiki/templates/tiki-lastchanges.tpl -text
tiki/templates/tiki-likepages.tpl -text
tiki/templates/tiki-list_cache.tpl -text
tiki/templates/tiki-list_gallery.tpl -text
tiki/templates/tiki-listpages.tpl -text
tiki/templates/tiki-page.tpl -text
tiki/templates/tiki-page_bar.tpl -text
tiki/templates/tiki-pagehistory.tpl -text
tiki/templates/tiki-pagepermissions.tpl -text
tiki/templates/tiki-preview.tpl -text
tiki/templates/tiki-print.tpl -text
tiki/templates/tiki-ranking.tpl -text
tiki/templates/tiki-register.tpl -text
tiki/templates/tiki-removepage.tpl -text
tiki/templates/tiki-rollback.tpl -text
tiki/templates/tiki-searchresults.tpl -text
tiki/templates/tiki-show_page.tpl -text
tiki/templates/tiki-top_bar.tpl -text
tiki/templates/tiki-upload_image.tpl -text
tiki/templates/tiki-userversions.tpl -text
tiki/templates/tiki-view_cache.tpl -text
tiki/templates/tiki.tpl -text
tiki/tiki-admin.php -text
tiki/tiki-admin_links.php -text
tiki/tiki-admin_modules.php -text
tiki/tiki-admin_modules.tpl -text
tiki/tiki-admingroups.php -text
tiki/tiki-adminusers.php -text
tiki/tiki-adminusers_old.php -text
tiki/tiki-assignpermission.php -text
tiki/tiki-assignuser.php -text
tiki/tiki-backlinks.php -text
tiki/tiki-browse_gallery.php -text
tiki/tiki-browse_image.php -text
tiki/tiki-editpage.php -text
tiki/tiki-featured_link.php -text
tiki/tiki-galleries.php -text
tiki/tiki-index.php -text
tiki/tiki-lastchanges.php -text
tiki/tiki-likepages.php -text
tiki/tiki-list_cache.php -text
tiki/tiki-list_gallery.php -text
tiki/tiki-listpages.php -text
tiki/tiki-login.php -text
tiki/tiki-logout.php -text
tiki/tiki-modules.php -text
tiki/tiki-pagehistory.php -text
tiki/tiki-pagepermissions.php -text
tiki/tiki-pagesetup.php -text
tiki/tiki-print.php -text
tiki/tiki-ranking.php -text
tiki/tiki-register.php -text
tiki/tiki-removepage.php -text
tiki/tiki-rollback.php -text
tiki/tiki-rss.php -text
tiki/tiki-searchresults.php -text
tiki/tiki-setup.php -text
tiki/tiki-upload-image.php -text
tiki/tiki-upload_image.php -text
tiki/tiki-userversions.php -text
tiki/tiki-view_cache.php -text
tiki/tiki_pagepermissions.php -text
Monte Ohrt <monte@ispi.net>
- idea of compiling into PHP scripts
- initial implementation
- documentation
Andrei Zmievski <andrei@php.net>
- rewrote parser from scratch
- maintains code base
- plugin architecture
- wrote Config_File class
- documentation
There are some bugs in older versions of PHP that cause problems with Smarty.
preg_replace() had a parameter added in 4.0.2 that is needed for Smarty.
preg_grep() previous to 4.0.4 has a bug which Smarty has a built-in workaround
for. PHP 4.0.4 has a bug with user callbacks which would cause this syntax in
Smarty to crash PHP: {$varname|@modname} Use PHP 4.0.4pl1 to fix this, or avoid
using the "@" with modifiers. if you are passing variables to {include}
statements, you will need PHP 4.0.4 or later, which requires the use of
get_defined_vars() function. Some versions of Windows 2k have a problem with
flock(). Comment out the flock() command in _write_file to get around this.
To be absolutely safe, use 4.0.6 or later with Smarty.
Smarty versions previous to 2.0 require the PEAR libraries. Be sure to include
the path to the PEAR libraries in your php include_path. Config_file.class.php
uses the PEAR library for its error handling routines. PEAR comes with the PHP
distribution. Unix users check /usr/local/lib/php, windows users check
C:/php/pear.
This diff is collapsed.
Monte Ohrt <monte@ispi.net>:
Concepted compiling templates into PHP scripts, wrote initial "proof of
concept" implementation, and maintains documentation & code base.
Andrei Zmievski <andrei@php.net>:
Rewrote parser from scratch, developed plugin architecture, reorganized
documentation, and maintains code base.
Anne Holz <anne@ispi.net>:
Provided creative input with respect to web design.
Frank Kromann <fmk@php.net>:
Idea of custom function ability.
A special thanks goes to the people that have contributed other templating
solutions to the PHP community which we learned a lot from.
A special thanks goes to the members of the php-template mailing list and the
smarty mailing list, too numerous to list, who are sharing and bringing many
ideas to the table and contributing source code.
Rasmus Lerdorf <rasmus@php.net>: For starting what eventually became the
coolest programming language ever.
This diff is collapsed.
<?php
/**
* Config_File class.
*
* @version 2.3.0
* @author Andrei Zmievski <andrei@php.net>
* @access public
*
* Copyright: 2001,2002 ispi of Lincoln, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* You may contact the author of Config_File by e-mail at:
* andrei@php.net
*
* Or, write to:
* Andrei Zmievski
* Software Engineer, ispi
* 237 S. 70th suite 220
* Lincoln, NE 68510
*
* The latest version of Config_File can be obtained from:
* http://www.phpinsider.com
*/
class Config_File {
/* Options */
/**
* Controls whether variables with the same name overwrite each other.
*
* @access public
*/
var $overwrite = true;
/**
* Controls whether config values of on/true/yes and off/false/no get
* converted to boolean values automatically.
*
* @access public
*/
var $booleanize = true;
/**
* Controls whether hidden config sections/vars are read from the file.
*
* @access public
*/
var $read_hidden = true;
/* Private variables */
var $_config_path = "";
var $_config_data = array();
var $_separator = "";
/**
* Constructs a new config file class.
*
* @param $config_path string (optional) path to the config files
* @access public
*/
function Config_File($config_path = NULL)
{
if (substr(PHP_OS, 0, 3) == "WIN" || substr(PHP_OS, 0, 4) == "OS/2")
$this->_separator = "\\";
else
$this->_separator = "/";
if (isset($config_path))
$this->set_path($config_path);
}
/**
* Set the path where configuration files can be found.
*
* @param $config_path string path to the config files
* @access public
*/
function set_path($config_path)
{
if (!empty($config_path)) {
if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
$this->_trigger_error_msg("Bad config file path '$config_path'");
return;
}
$this->_config_path = $config_path . $this->_separator;
}
}
/**
* Retrieves config info based on the file, section, and variable name.
*
* @access public
* @param $file_name string config file to get info for
* @param $section_name string (optional) section to get info for
* @param $var_name string (optional) variable to get info for
* @return mixed a value or array of values
*/
function &get($file_name, $section_name = NULL, $var_name = NULL)
{
if (empty($file_name)) {
$this->_trigger_error_msg('Empty config file name');
return;
} else {
$file_name = $this->_config_path . $file_name;
if (!isset($this->_config_data[$file_name]))
$this->load_file($file_name, false);
}
if (!empty($var_name)) {
if (empty($section_name)) {
return $this->_config_data[$file_name]["vars"][$var_name];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
else
return array();
}
} else {
if (empty($section_name)) {
return (array)$this->_config_data[$file_name]["vars"];
} else {
if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
else
return array();
}
}
}
/**
* Retrieves config info based on the key.
*
* @access public
* @param $file_name string config key (filename/section/var)
* @return mixed a value or array of values
*/
function &get_key($config_key)
{
list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
$result = &$this->get($file_name, $section_name, $var_name);
return $result;
}
/**
* Get all loaded config file names.
*
* @access public
* @return array an array of loaded config file names
*/
function get_file_names()
{
return array_keys($this->_config_data);
}
/**
* Get all section names from a loaded file.
*
* @access public
* @param $file_name string config file to get section names from
* @return array an array of section names from the specified file
*/
function get_section_names($file_name)
{
$file_name = $this->_config_path . $file_name;
if (!isset($this->_config_data[$file_name])) {
$this->_trigger_error_msg("Unknown config file '$file_name'");
return;
}
return array_keys($this->_config_data[$file_name]["sections"]);
}
/**
* Get all global or section variable names.
*
* @access public
* @param $file_name string config file to get info for
* @param $section_name string (optional) section to get info for
* @return array an array of variables names from the specified file/section
*/
function get_var_names($file_name, $section = NULL)
{
if (empty($file_name)) {
$this->_trigger_error_msg('Empty config file name');
return;
} else if (!isset($this->_config_data[$file_name])) {
$this->_trigger_error_msg("Unknown config file '$file_name'");
return;
}
if (empty($section))
return array_keys($this->_config_data[$file_name]["vars"]);
else
return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
}
/**
* Clear loaded config data for a certain file or all files.
*
* @access public
* @param $file_name string file to clear config data for
*/
function clear($file_name = NULL)
{
if ($file_name === NULL)
$this->_config_data = array();
else if (isset($this->_config_data[$file_name]))
$this->_config_data[$file_name] = array();
}
/**
* Load a configuration file manually.
*
* @access public
* @param $file_name string file name to load
* @param $prepend_path boolean whether current config path should be prepended to the filename
*/
function load_file($file_name, $prepend_path = true)
{
if ($prepend_path && $this->_config_path != "")
$config_file = $this->_config_path . $file_name;
else
$config_file = $file_name;
ini_set('track_errors', true);
$fp = @fopen($config_file, "r");
if (!is_resource($fp)) {
$this->_trigger_error_msg("Could not open config file '$config_file'");
return;
}
$contents = fread($fp, filesize($config_file));
fclose($fp);
$config_data = array();
/* Get global variables first. */
if (preg_match("/^(.*?)(\n\[|\Z)/s", $contents, $match))
$config_data["vars"] = $this->_parse_config_block($match[1]);
/* Get section variables. */
$config_data["sections"] = array();
preg_match_all("/^\[(.*?)\]/m", $contents, $match);
foreach ($match[1] as $section) {
if ($section{0} == '.' && !$this->read_hidden)
continue;
if (preg_match("/\[".preg_quote($section)."\](.*?)(\n\[|\Z)/s", $contents, $match))
if ($section{0} == '.')
$section = substr($section, 1);
$config_data["sections"][$section]["vars"] = $this->_parse_config_block($match[1]);
}
$this->_config_data[$config_file] = $config_data;
}
function _parse_config_block($config_block)
{
$vars = array();
/* First we grab the multi-line values. */
if (preg_match_all("/^([^=\n]+)=\s*\"{3}(.*?)\"{3}\s*$/ms", $config_block, $match, PREG_SET_ORDER)) {
for ($i = 0; $i < count($match); $i++) {
$this->_set_config_var($vars, trim($match[$i][1]), $match[$i][2], false);
}
$config_block = preg_replace("/^[^=\n]+=\s*\"{3}.*?\"{3}\s*$/ms", "", $config_block);
}
$config_lines = preg_split("/\n+/", $config_block);
foreach ($config_lines as $line) {
if (preg_match("/^\s*(\.?\w+)\s*=(.*)/", $line, $match)) {
$var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', trim($match[2]));
$this->_set_config_var($vars, trim($match[1]), $var_value, $this->booleanize);
}
}
return $vars;
}
function _set_config_var(&$container, $var_name, $var_value, $booleanize)
{
if ($var_name{0} == '.') {
if (!$this->read_hidden)
return;
else
$var_name = substr($var_name, 1);
}
if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
$this->_trigger_error_msg("Bad variable name '$var_name'");
return;
}
if ($booleanize) {
if (preg_match("/^(on|true|yes)$/i", $var_value))
$var_value = true;
else if (preg_match("/^(off|false|no)$/i", $var_value))
$var_value = false;
}
if (!isset($container[$var_name]) || $this->overwrite)
$container[$var_name] = $var_value;
else {
settype($container[$var_name], 'array');
$container[$var_name][] = $var_value;
}
}
function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
{
trigger_error("Config_File error: $error_msg", $error_type);
}
}
?>
This diff is collapsed.
REQUIREMENTS:
Smarty requires PHP 4.0.6 or later.
INSTALLATION:
* copy the Smarty.class.php, Smarty_Compile.class.php Config_File.class.php
scripts and the plugins directory to a directory that is in your PHP
include_path, or set the SMARTY_DIR constant and put your class files in this
directory.
* create a "templates", "configs", and a "templates_c" directory,
be sure to set the appropriate directory settings in Smarty for them. If they
are located in the same directory as your application, they shouldn't need to
be modified. Be sure the "templates_c" directory is writable by your web
server user (usually nobody). chown nobody:nobody templates_c; chmod 700
templates_c You can also chmod 777 this directory, but be aware of security
issues for multi-user systems. If you are using Smarty's built-in caching,
create a "cache" directory and also chown nobody:nobody.