Source for file legacy.php
Documentation is available at legacy.php
* Zikula Application Framework
* @copyright (c) 2001, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: legacy.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @subpackage Zikula_legacy
* Delete quotes in a string
// No recursive function to add quote to an HTML tag if needed
// and delete duplicate spaces between attribs.
$tmp = ""; // string buffer
$result = ""; // result string
$attrib = - 1; // Are us in an HTML attrib ? -1: no attrib 0: name of the attrib 1: value of the atrib
$quote = 0; // Is a string quote delimited opened ? 0=no, 1=yes
switch ($string[$i]) { // What car is it in the buffer ?
case "\"": // " // a quote.
if (($attrib > 0) && ($tmp != "")) {
case "=": // an equal - attrib delimiter
if ($quote == 0) { // Is it found in a string ?
if ($attrib > 0) { // add it to the string, if one opened.
if ($attrib < 0) { // If we weren't in an attrib, set attrib to 0= 0;
if (($quote != 0) && ($tmp != "")) {
* If it is the value of an atrib, add the '='
* Add quote if needed (the reason of the function ;-)
* Fixes quoting on a string
* This function replaces all single single quotes with double single quotes
* (' becomes '') and all occurrences of \' with '.
* @param $what string The string to be fixed
* @return string The fixed string
while (eregi("\\\\'", $what)) {
* Checks allowed HTML in a string
// The core of this code has been lifted from phpslash
// which is licenced under the GPL.
if ($strip == "nohtml") {
$AllowableHTML = array('');
// Delete all spaces from html tags .
$str = eregi_replace("<a[^>]*href[[:space:]]*=[[:space:]]*\"?[[:space:]]*([^\" >]*)[[:space:]]*\"?[^>]*>",
'<a href="\\1">', $str); // "
// Delete all attribs from Anchor, except an href, double quoted.
while (ereg("<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>", $str, $reg)) {
if (isset ($AllowableHTML[$tag])) {
if ($a = $AllowableHTML[$tag]) {
} elseif (($a == 1) || ($reg[2] == "")) {
// Place here the double quote fix function.
$tag = "<$tag" . $attrb_list . ">";
} // Attribs in tag allowed
$tmp .= substr($str, 0, $i) . $tag;
// Squash PHP tags unconditionally
* Filter text through both censor and allowed HTML
$EditedMessage = check_html($EditedMessage, $strip);
// Below ereg commented out 07-08-2001:Alarion - less strict ereg thanks to "Joe"
// ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);
ereg ("([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+)", $time, $datetime);
// 07-07-2001:Alarion - For the time being, I added an ereg_replace to strip out
// the timezone until I get a function in to replace the server timezone with the users timezone
* include_once replacement
* Works basicly like include_once() (except not
* include() aware, I'm not sure what array name
* they use). Needed for older PHP4 installs.
* @param $f string The file/path to include
* @return false if file was already included. true if first include
* @author Patrick Kellum <webmaster@ctarl-ctarl.com>
function pninclude_once($f)
* Check string for censored words
* cross site scripting check
function csssafe($checkArg = "op", $checkReferer = true)
function myTextForm($url , $value , $useTable = false , $extraname = "postnuke")
$form = '<form action="'. $url. '" method="post">'. "\n";
$form .= '<table border="0" width="100%" align="center"><tr><td>'. "\n";
$form .= '<input type="submit" value="'. $value. '" class="pn-normal" style="text-align:center">';
$form .= '<input type="hidden" name="'. $extraname. '" value="'. $extraname. '"></form>'. "\n";
$form .= '</td></tr></table>'. "\n";
* Error message due a ADODB SQL error and die
function PN_DBMsgError($db= '',$prg= '',$line= 0,$message= 'Error Accesing the Database')
* simplied version of initial fix supplied by Neo
* original fix by markwest
$lcmessage = $message . "<br>" .
"Program: " . $prgoutput . " - " . "Line N.: " . $line . "<br>" .
"Database: " . $db->database . "<br> ";
$lcmessage .= "Error (" . $db->ErrorNo() . ") : " . $db->ErrorMsg() . "<br>";
$lcmessage = $message . "<br>" . "Program: " . $prgoutput . " - " . "Line N.: " . $line . "<br>";
$lcmessage .= "Error (" . $db->ErrorNo() . ") : " . $db->ErrorMsg() . "<br>";
/* spliffster - moved to _module_vars '/PNConfig' 'timezone_info' */
// fixed notice error [class007]
|