コード例 #1
0
ファイル: search.php プロジェクト: javierlov/FuentesWeb
        }
    }
    $LogString = $LogString . ", Time = " . $timetaken;
    $LogString = $LogString . ", Rec = " . $num_recs_found;
    // end of entry
    $LogString = $LogString . "\r\n";
    $fp = fopen($LogFileName, "ab");
    if ($fp != false) {
        fputs($fp, $LogString);
        fclose($fp);
    } else {
        $OutputResultsBuffer .= "Unable to write to log file (" . $LogFileName . "). Check that you have specified the correct log filename in your Indexer settings and that you have the required file permissions set.<br />";
    }
}
//Print out the end of the template
ShowTemplate();
// ----------------------------------------------------------------------------------
// Porter Stemming algorithm by Dr Martin Porter.
// PHP5 implementation by Richard Heyes, copyright 2005.
// PHP4 support and additional features by Wrensoft, copyright 2009.
// The PorterStemmer class is available for use "free of charge for any purpose" as
// published on Martin Porter's website (http://tartarus.org/~martin/PorterStemmer/)
// ----------------------------------------------------------------------------------
class PorterStemmer
{
    var $regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)';
    var $regex_vowel = '(?:[aeiou]|(?<![aeiou])y)';
    var $StemStopChars = '`1234567890-=[]\\;\',./~!@#$%^&*_+|:"<>?';
    function Stem($word)
    {
        if (strlen($word) <= 2) {
コード例 #2
0
ファイル: formmail.php プロジェクト: soar-team/kloxo
function ShowError($error_code, $error_mesg, $b_user_error, $b_alerted = false, $a_item_list = array(), $s_extra_info = "")
{
    global $SPECIAL_FIELDS, $SPECIAL_MULTI, $SPECIAL_VALUES, $aSessionVars, $aStrippedFormVars;
    //
    // Testing with PHP 4.0.6 indicates that sessions don't always work.
    // So, we'll also add the error to the URL, unless
    // PUT_DATA_IN_URL is false.
    //
    $aSessionVars["FormError"] = $error_mesg;
    $aSessionVars["FormErrorInfo"] = $s_extra_info;
    $aSessionVars["FormErrorCode"] = $error_code;
    $aSessionVars["FormErrorItems"] = $a_item_list;
    $aSessionVars["FormIsUserError"] = $b_user_error;
    $aSessionVars["FormAlerted"] = $b_alerted;
    $aSessionVars["FormData"] = array();
    $bad_url = $SPECIAL_VALUES["bad_url"];
    $bad_template = $SPECIAL_VALUES["bad_template"];
    $this_form = $SPECIAL_VALUES["this_form"];
    if (!empty($bad_url)) {
        $a_params = array();
        $a_params[] = "this_form=" . urlencode("{$this_form}");
        $a_params[] = "bad_template=" . urlencode("{$bad_template}");
        if (PUT_DATA_IN_URL) {
            $a_params[] = "error=" . urlencode("{$error_mesg}");
            $a_params[] = "extra=" . urlencode("{$s_extra_info}");
            $a_params[] = "errcode=" . urlencode("{$error_code}");
            $a_params[] = "isusererror=" . ($b_user_error ? "1" : "0");
            $a_params[] = "alerted=" . ($b_alerted ? "1" : "0");
            $i_count = 1;
            foreach ($a_item_list as $s_item) {
                $a_params[] = "erroritem{$i_count}=" . urlencode("{$s_item}");
                $i_count++;
            }
        } else {
            //
            // tell the bad_url to look in the session only
            //
            $a_params[] = "insession=1";
        }
        //
        // Add the posted data to the URL so that an intelligent
        // $bad_url can call the form again
        //
        foreach ($aStrippedFormVars as $s_name => $m_value) {
            //
            // skip special fields
            //
            $b_special = false;
            if (in_array($s_name, $SPECIAL_FIELDS)) {
                $b_special = true;
            } else {
                foreach ($SPECIAL_MULTI as $s_multi_fld) {
                    $i_len = strlen($s_multi_fld);
                    if (substr($s_name, 0, $i_len) == $s_multi_fld) {
                        $i_index = (int) substr($s_name, $i_len);
                        if ($i_index > 0) {
                            $b_special = true;
                            break;
                        }
                    }
                }
            }
            if (!$b_special) {
                if (PUT_DATA_IN_URL) {
                    if (is_array($m_value)) {
                        foreach ($m_value as $s_value) {
                            $a_params[] = "{$s_name}" . '[]=' . urlencode(substr($s_value, 0, MAXSTRING));
                        }
                    } else {
                        $a_params[] = "{$s_name}=" . urlencode(substr($m_value, 0, MAXSTRING));
                    }
                } else {
                    if (is_array($m_value)) {
                        $aSessionVars["FormData"]["{$s_name}"] = $m_value;
                    } else {
                        $aSessionVars["FormData"]["{$s_name}"] = substr($m_value, 0, MAXSTRING);
                    }
                }
            }
        }
        $bad_url = AddURLParams($bad_url, $a_params, false);
        Redirect($bad_url);
    } else {
        if (!empty($bad_template)) {
            $a_specs = array("fmerror" => htmlspecialchars("{$error_mesg}"), "fmerrorcode" => htmlspecialchars("{$error_code}"), "fmfullerror" => htmlspecialchars("{$error_mesg}") . "\n" . htmlspecialchars("{$s_extra_info}"), "fmerrorextra" => htmlspecialchars("{$s_extra_info}"));
            $i_count = 1;
            foreach ($a_item_list as $s_item) {
                $a_specs["fmerroritem{$i_count}"] = htmlspecialchars($s_item);
                $i_count++;
            }
            $s_list = "";
            foreach ($a_item_list as $s_item) {
                $s_list .= "<li>" . htmlspecialchars($s_item) . "</li>\n";
            }
            $a_specs["fmerroritemlist"] = $s_list;
            if (ShowTemplate($bad_template, $a_specs)) {
                return;
            }
        }
        $s_text = GetMessage(MSG_ERROR_PROC);
        if ($b_user_error) {
            $s_text .= $error_mesg . "\n" . $s_extra_info;
        } else {
            if ($b_alerted) {
                $s_text .= GetMessage(MSG_ALERT_DONE);
            } else {
                $s_text .= GetMessage(MSG_PLS_CONTACT);
            }
            $s_text .= GetMessage(MSG_APOLOGY);
        }
        CreatePage($s_text);
        //
        // the session data is not needed now
        //
        ZapSession();
    }
}
コード例 #3
0
            foreach ($aItems as $sItem) {
                $aSpecs["fmerroritem{$iCount}"] = htmlspecialchars($sItem);
                $iCount++;
            }
            $sList = "";
            foreach ($aItems as $sItem) {
                $sList .= "<li>" . htmlspecialchars($sItem) . "</li>\n";
            }
            $aSpecs["fmerroritemlist"] = $sList;
        } else {
            for ($iCount = 1; $iCount <= 20; $iCount++) {
                $aSpecs["fmerroritem{$iCount}"] = "";
            }
            $aSpecs["fmerroritemlist"] = "";
        }
        ShowTemplate($aGetVars["bad_template"], $aSpecs);
    } else {
        ?>
		<html>
		<body>
		<h2>Form Error</h2>
		<p>Your form submission failed due to the following reason:</p>
		<p><?php 
        echo nl2br($sErrorMesg);
        ?>
</p>
		<ul>
			<?php 
        foreach ($aItems as $s_item) {
            echo "<li>{$s_item}</li>";
        }
コード例 #4
0
            $aSpecs["fmerroritem{$iCount}"] = "";
        }
        $aSpecs["fmerroritemlist"] = "";
        if ($bIsUserError) {
            $iCount = 1;
            foreach ($aItems as $sItem) {
                $aSpecs["fmerroritem{$iCount}"] = htmlspecialchars($sItem);
                $iCount++;
            }
            $sList = "";
            foreach ($aItems as $sItem) {
                $sList .= "<li>" . htmlspecialchars($sItem) . "</li>";
            }
            $aSpecs["fmerroritemlist"] = $sList;
        }
        ShowTemplate($sBadTemplate, $aSpecs);
    } else {
        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Form Submission Error</title>
        </head>
        <body>
		<h2>Form Error</h2>
		<p>Your form submission failed due to the following reason:</p>
		<p><?php 
        echo nl2br(htmlspecialchars($sErrorMesg));
        ?>
</p>