Beispiel #1
0
function FilterData($data, $formdef)
{
    // Para cada elemento de data
    foreach ($data as $key => $element) {
        $data[$key] = Filter($element, getElementDef($formdef, $key));
    }
    return $data;
}
Beispiel #2
0
/**
 * Filtro de datos segun el tipo de campo a rellenar
 * @param string $post
 * @param string $formdef
 * @return array
 */
function filterData($post, $formdef)
{
    //Para cada elemento de data
    foreach ($post as $type => $value) {
        $post[$type] = Filter($value, getElementDef($formdef, $type));
        // Filtrar segun sus filtros en formdef
        // Switch de filtros
    }
    return $post;
}
function SendResults($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields)
{
    global $SPECIAL_VALUES, $aFileVars, $FILE_REPOSITORY, $FIXED_SENDER;
    //
    // check for a filter and how to use it
    //
    $b_filter_attach = false;
    $a_attach_spec = array();
    $s_filter = "";
    $a_filter_list = array();
    if ($b_got_filter = GetFilterSpec($s_filter, $a_filter_list)) {
        if ($a_filter_list === false) {
            //
            // not a limited filter, so filter all fields
            //
            $b_limited_filter = false;
            $a_filter_list = array();
        } else {
            $b_limited_filter = true;
        }
        FMDebug("SendResults: got filter '{$s_filter}', limited={$b_limited_filter}");
        $s_filter_attach_name = GetFilterOption("Attach");
        if (isset($s_filter_attach_name)) {
            if (!is_string($s_filter_attach_name) || empty($s_filter_attach_name)) {
                SendAlert(GetMessage(MSG_ATTACH_NAME));
            } else {
                $b_filter_attach = true;
                $a_attach_spec = array("Name" => $s_filter_attach_name);
                if (($s_mime = GetFilterAttrib($s_filter, "MIME")) !== false) {
                    $a_attach_spec["MIME"] = $s_mime;
                }
                //
                // Regarding the character set...
                // A filter will not generally change the character set
                // of the message, however, if it does, then we
                // provide that information to the MIME encoder.
                // Remember: this character set specification refers
                // to the data *after* the effect of the filter
                // has been reversed (e.g. an encrypted message
                // in UTF-8 is in UTF-8 when it is decrypted).
                //
                if (($s_cset = GetFilterAttrib($s_filter, "CharSet")) !== false) {
                    $a_attach_spec["CharSet"] = $s_cset;
                }
            }
        }
    }
    //
    // check the need for MIME formatted mail
    //
    $b_mime_mail = IsMailOptionSet("HTMLTemplate") || count($aFileVars) > 0 || $b_filter_attach;
    //
    // create the email header lines - CC, BCC, From, and Reply-To
    //
    $a_headers = array();
    if (!empty($s_cc)) {
        $a_headers['Cc'] = SafeHeader($s_cc);
    }
    if (!empty($SPECIAL_VALUES["replyto"])) {
        //
        // expand replyto list
        //
        CheckEmailAddress($SPECIAL_VALUES["replyto"], $s_list, $s_invalid, false);
        if (!empty($s_list)) {
            $a_headers['Reply-To'] = SafeHeader($s_list);
        }
    }
    //
    // note that BCC is documented to not work prior to PHP 4.3
    //
    if (!empty($s_bcc)) {
        global $aPHPVERSION;
        if ($aPHPVERSION[0] < 4 || $aPHPVERSION[0] == 4 && $aPHPVERSION[1] < 3) {
            SendAlert(GetMessage(MSG_PHP_BCC, array("PHPVERS" => implode(".", $aPHPVERSION))));
        }
        $a_headers['Bcc'] = SafeHeader($s_bcc);
    }
    //
    // create the From address
    //
    // Some servers won't let you set the email address to the
    // submitter of the form.  Therefore, use FromAddr if it's been
    // specified to set the sender and the "From" address.
    //
    $s_sender = GetMailOption("FromAddr");
    if (!isset($s_sender)) {
        $s_sender = "";
        if (!empty($SPECIAL_VALUES["email"])) {
            $a_headers['From'] = MakeFromLine($SPECIAL_VALUES["email"], $SPECIAL_VALUES["realname"]);
        }
    } elseif ($s_sender !== "") {
        $s_sender = $a_headers['From'] = SafeHeader(UnMangle($s_sender));
    }
    /* 
     * Override sender if $FIXED_SENDER is set.
     */
    if ($FIXED_SENDER !== "") {
        $s_sender = $FIXED_SENDER;
    }
    if ($s_sender === "") {
        if (SET_SENDER_FROM_EMAIL) {
            $s_sender = $SPECIAL_VALUES["email"];
        }
    }
    //
    // special case: if there is only one non-special string value, then
    // format it as an email (unless an option says not to)
    //
    $a_keys = array_keys($a_raw_fields);
    if (count($a_keys) == 1 && is_string($a_raw_fields[$a_keys[0]]) && !IsMailOptionSet("AlwaysList") && !IsMailOptionSet("DupHeader")) {
        if (IsMailExcluded($a_keys[0])) {
            SendAlert("Exclusion of single field '" . $a_keys[0] . "' ignored");
        }
        $s_value = $a_raw_fields[$a_keys[0]];
        //
        // replace carriage return/linefeeds with <br>
        //
        $s_value = str_replace("\r\n", '<br />', $s_value);
        //
        // replace lone linefeeds with <br>
        //
        $s_value = str_replace("\n", '<br />', $s_value);
        //
        // remove lone carriage returns
        //
        $s_value = str_replace("\r", "", $s_value);
        //
        // replace all control chars with <br />
        //
        $s_value = preg_replace('/[[:cntrl:]]+/', '<br />', $s_value);
        //
        // strip HTML (note that all the <br> above will now be
        // replaced with BODY_LF)
        //
        $s_value = StripHTML($s_value, BODY_LF);
        if ($b_mime_mail) {
            if ($b_got_filter) {
                //
                // filter the whole value (ignore filter_fields for this
                // special case) if a filter has been specified
                //
                $s_results = Filter($s_filter, $s_value);
                if ($b_filter_attach) {
                    $a_attach_spec["Data"] = $s_results;
                    //
                    // KeepInLine keeps the filtered version inline as well
                    // as an attachment
                    //
                    if (!IsFilterOptionSet("KeepInLine")) {
                        $s_results = "";
                    }
                    $s_filter = "";
                    // no more filtering
                }
            } else {
                $s_results = $s_value;
            }
            //
            // send this single value off to get formatted in a MIME
            // email
            //
            if (!MakeMimeMail($s_results, $a_headers, $a_raw_fields, GetMailOption('HTMLTemplate'), GetMailOption('TemplateMissing'), IsMailOptionSet("NoPlain"), $s_filter, $aFileVars, $a_attach_spec)) {
                return false;
            }
        } elseif ($b_got_filter) {
            //
            // filter the whole value (ignore filter_fields for this special case)
            // if a filter has been specified
            //
            $s_results = Filter($s_filter, $s_value);
        } else {
            $s_results = $s_value;
            if (IsMailOptionSet("CharSet")) {
                //
                // sending plain text email, and the CharSet has been
                // specified; include a header
                //
                $a_headers['Content-Type'] = "text/plain; charset=" . SafeHeader(GetMailOption("CharSet"));
            }
        }
    } else {
        if ($b_mime_mail) {
            //
            // get the plain text version of the email then send it
            // to get MIME formatted
            //
            list($s_results, $s_unfiltered_results, $s_filtered_results) = MakePlainEmail($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields, $s_filter, $a_filter_list);
            if ($b_filter_attach) {
                //
                // attached the filtered results
                //
                $a_attach_spec["Data"] = $s_filtered_results;
                //
                // KeepInLine keeps the filtered version inline as well
                // as an attachment
                //
                if (!IsFilterOptionSet("KeepInLine")) {
                    //
                    // put the unfiltered results in the body of the message
                    //
                    $s_results = $s_unfiltered_results;
                }
                $s_filter = "";
                // no more filtering
            }
            if (!MakeMimeMail($s_results, $a_headers, $a_raw_fields, GetMailOption('HTMLTemplate'), GetMailOption('TemplateMissing'), IsMailOptionSet("NoPlain"), $s_filter, $aFileVars, $a_attach_spec)) {
                return false;
            }
        } else {
            list($s_results, $s_unfiltered_results, $s_filtered_results) = MakePlainEmail($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields, $s_filter, $a_filter_list);
            if (!$b_got_filter && IsMailOptionSet("CharSet")) {
                //
                // sending plain text email, and the CharSet has been
                // specified; include a header
                //
                $a_headers['Content-Type'] = "text/plain; charset=" . SafeHeader(GetMailOption("CharSet"));
            }
        }
    }
    //
    // now save uploaded files to the repository
    //
    if (FILEUPLOADS && $FILE_REPOSITORY !== "") {
        if (!SaveAllFilesToRepository()) {
            return false;
        }
    }
    //
    // send the mail - assumes the email addresses have already been checked
    //
    return SendCheckedMail($s_to, $SPECIAL_VALUES["subject"], $s_results, $s_sender, $a_headers);
}
Beispiel #4
0
    <th><?echo translate("Server");?></th>
    <th><?echo translate("Source");?></th>
    <th><?echo translate("Session");?></th>
    <th><?echo translate("PID");?></th>
    <th><?echo translate("Client");?></th>
    <th><?echo translate("Priority");?></th>
</tr></th><?
foreach($logs as $log) {
    $info = adeiGetLogInfo($log['logfile'], $log['filepos']);
    if ($filter) {
	if (($filter["db_server"])&&($info['GET']['db_server'] != $filter["db_server"])) continue;
    }
    echo "<tr>";
    echo "<td>" . ShowTime($log['time']) . "</td>";
    echo "<td><a href=\"" . Filter($log, 'setup') . "\">" . $log['setup'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'db_server', $info['GET']['db_server']) . "\">" . $info['GET']['db_server'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'source') . "\">" . $log['source'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'session') . "\">" . $log['session'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'pid') . "\">" . $log['pid'] . "</a></td>";
    echo "<td><a href=\"" . Filter($log, 'client') . "\">" . $log['client'] . "</a></td>";
    echo "<td>" . $log['priority'] . "</td>";
    echo "<tr><td colspan=\"7\"><a href=\"index.php?page=loginfo.php&logfile=" . $log['logfile'] . "&logpos=" . $log['filepos']  . "\">" . $log['message'] . "</a></td></tr>";
    
    echo "</tr>";
//    print_r($log);
}
?></table><?



?>
        $jml = $w['DefJumlah'] * $w['Jumlah'];
        $a .= str_pad($det, 15, ' ', STR_PAD_LEFT);
    } else {
        $a .= str_pad(' ', 15, ' ');
        $jml = $w['Jumlah'];
    }
    $tot = $jml;
    $a .= str_pad(number_format($jml), 20, ' ', STR_PAD_LEFT);
    return $a . $_lf;
}
function TampilkanBIPOTCAMA1($PMBID, $thn)
{
    $s = "select bp.*\r\n    from bipotmhsw bp\r\n    where bp.PMBID='{$PMBID}' and bp.TahunID='{$thn}' and TrxID = 1";
    $r = _query($s);
    $n = 0;
    //$ttl = 0; $byr = 0;
    //echo "<pre>$s</pre>";
    while ($w = _fetch_array($r)) {
        $ttl += $w['Jumlah'] * $w['Besar'];
        $byr += $w['Dibayar'];
    }
    $strttl = number_format($ttl, 0);
    $strbyr = number_format($byr, 0);
    return $strttl . '|' . $strbyr;
}
$tahun = GetSetVar('tahun');
TampilkanJudul("Mengecek Bipot Mahasiswa Baru");
Filter();
if (!empty($tahun)) {
    daftar();
}
Beispiel #6
0
function SendResults($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields)
{
    global $SPECIAL_VALUES, $aFileVars;
    //
    // check for a filter and how to use it
    //
    $b_got_filter = isset($SPECIAL_VALUES["filter"]) && !empty($SPECIAL_VALUES["filter"]);
    $b_filter_attach = false;
    $a_attach_spec = array();
    $s_filter = "";
    $a_filter_list = array();
    if ($b_got_filter) {
        $s_filter = $SPECIAL_VALUES["filter"];
        if (isset($SPECIAL_VALUES["filter_fields"]) && !empty($SPECIAL_VALUES["filter_fields"])) {
            $b_limited_filter = true;
            $a_filter_list = TrimArray(explode(",", $SPECIAL_VALUES["filter_fields"]));
        } else {
            $b_limited_filter = false;
        }
        $s_filter_attach_name = GetFilterOption("Attach");
        if (isset($s_filter_attach_name)) {
            if (!is_string($s_filter_attach_name) || empty($s_filter_attach_name)) {
                SendAlert("filter_options: Attach must contain a name (e.g. Attach=data.txt)");
            } else {
                $b_filter_attach = true;
                $a_attach_spec = array("Name" => $s_filter_attach_name);
                if (($s_mime = GetFilterAttrib($s_filter, "MIME")) !== false) {
                    $a_attach_spec["MIME"] = $s_mime;
                }
                //
                // Regarding the character set...
                // A filter will not generally change the character set
                // of the message, however, if it does, then we
                // provide that information to the MIME encoder.
                // Remember: this character set specification refers
                // to the data *after* the effect of the filter
                // has been reversed (e.g. an encrypted message
                // in UTF-8 is in UTF-8 when it is decrypted).
                //
                if (($s_cset = GetFilterAttrib($s_filter, "CharSet")) !== false) {
                    $a_attach_spec["CharSet"] = $s_cset;
                }
            }
        }
    }
    //
    // check the need for MIME formatted mail
    //
    $b_mime_mail = IsMailOptionSet("HTMLTemplate") || count($aFileVars) > 0 || $b_filter_attach;
    //
    // create the email header lines - CC, BCC, and From
    //
    $a_headers = array();
    if (!empty($s_cc)) {
        $a_headers['Cc'] = $s_cc;
    }
    //
    // note that BCC is documented to not work prior to PHP 4.3
    //
    if (!empty($s_bcc)) {
        global $aPHPVERSION;
        if ($aPHPVERSION[0] < 4 || $aPHPVERSION[0] == 4 && $aPHPVERSION[1] < 3) {
            SendAlert("Warning: BCC is probably not supported on your PHP version (" . implode(".", $aPHPVERSION) . ")");
        }
        $a_headers['Bcc'] = $s_bcc;
    }
    //
    // create the From address
    //
    if (!empty($SPECIAL_VALUES["email"])) {
        $a_headers['From'] = MakeFromLine($SPECIAL_VALUES["email"], $SPECIAL_VALUES["realname"]);
    }
    //
    // special case: if there is only one non-special string value, then
    // format it as an email (unless an option says not to)
    //
    $a_keys = array_keys($a_raw_fields);
    if (count($a_keys) == 1 && is_string($a_raw_fields[$a_keys[0]]) && !IsMailOptionSet("AlwaysList") && !IsMailOptionSet("DupHeader")) {
        if (IsMailExcluded($a_keys[0])) {
            SendAlert("Exclusion of single field '" . $a_keys[0] . "' ignored");
        }
        $s_value = $a_raw_fields[$a_keys[0]];
        //
        // replace carriage return/linefeeds with <br>
        //
        $s_value = str_replace("\r\n", '<br />', $s_value);
        //
        // replace lone linefeeds with <br>
        //
        $s_value = str_replace("\n", '<br />', $s_value);
        //
        // remove lone carriage returns
        //
        $s_value = str_replace("\r", "", $s_value);
        //
        // replace all control chars with <br>
        //
        $s_value = preg_replace('/[[:cntrl:]]+/', '<br />', $s_value);
        //
        // strip HTML (note that all the <br> above will now be
        // replaced with BODY_LF)
        //
        $s_value = StripHTML($s_value, BODY_LF);
        if ($b_mime_mail) {
            if ($b_got_filter) {
                //
                // filter the whole value (ignore filter_fields for this
                // special case) if a filter has been specified
                //
                $s_results = Filter($s_filter, $s_value);
                if ($b_filter_attach) {
                    $a_attach_spec["Data"] = $s_results;
                    $s_results = "";
                    $s_filter = "";
                    // no more filtering
                }
            } else {
                $s_results = $s_value;
            }
            //
            // send this single value off to get formatted in a MIME
            // email
            //
            if (!MakeMimeMail($s_results, $a_headers, $a_raw_fields, GetMailOption('HTMLTemplate'), GetMailOption('TemplateMissing'), IsMailOptionSet("NoPlain"), $s_filter, $aFileVars, $a_attach_spec)) {
                return false;
            }
        } elseif ($b_got_filter) {
            //
            // filter the whole value (ignore filter_fields for this special case)
            // if a filter has been specified
            //
            $s_results = Filter($s_filter, $s_value);
        } else {
            $s_results = $s_value;
        }
    } else {
        if ($b_mime_mail) {
            //
            // get the plain text version of the email then send it
            // to get MIME formatted
            //
            list($s_results, $s_unfiltered_results, $s_filtered_results) = MakePlainEmail($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields, $s_filter, $a_filter_list);
            if ($b_filter_attach) {
                //
                // attached the filtered results
                //
                $a_attach_spec["Data"] = $s_filtered_results;
                //
                // put the unfiltered results in the body of the message
                //
                $s_results = $s_unfiltered_results;
                $s_filter = "";
                // no more filtering
            }
            if (!MakeMimeMail($s_results, $a_headers, $a_raw_fields, GetMailOption('HTMLTemplate'), GetMailOption('TemplateMissing'), IsMailOptionSet("NoPlain"), $s_filter, $aFileVars, $a_attach_spec)) {
                return false;
            }
        } else {
            list($s_results, $s_unfiltered_results, $s_filtered_results) = MakePlainEmail($a_fld_order, $a_clean_fields, $s_to, $s_cc, $s_bcc, $a_raw_fields, $s_filter, $a_filter_list);
            if (!$b_got_filter && IsMailOptionSet("CharSet")) {
                //
                // sending plain text email, and the CharSet has been
                // specified; include a header
                //
                $a_headers['Content-Type'] = "text/plain; charset=" . GetMailOption("CharSet");
            }
        }
    }
    //
    // append the environment variables report
    //
    if (isset($SPECIAL_VALUES["env_report"])) {
        $s_results .= BODY_LF . "==================================" . BODY_LF;
        $s_results .= BODY_LF . GetEnvVars(TrimArray(explode(",", $SPECIAL_VALUES["env_report"])), BODY_LF);
    }
    //
    // send the mail - assumes the email addresses have already been checked
    //
    return SendCheckedMail($s_to, $SPECIAL_VALUES["subject"], $s_results, $SPECIAL_VALUES["email"], $a_headers);
}
Beispiel #7
0
<INPUT TYPE="HIDDEN" NAME="Page" VALUE="List">
<INPUT TYPE="HIDDEN" NAME="Limit" VALUE="0">
<TR><TD><TABLE CLASS="Box">
<TR><TH>Visible columns <FONT ONCLICK="InfoBox ('This is the visivle columns section', 'Here you can choose which fields that should be displayed in the results list.<BR>Multiple options are allowed.');">[?]</FONT></TH></TR>
<TR><TD><SELECT NAME="Selected[]" SIZE="10" MULTIPLE><?php 
echo FilterOptions($Post['Selected']);
?>
</SELECT></TD></TR>
</TABLE></TD>
<TD ALIGN="RIGHT"><TABLE CLASS="Box">
<TH COLSPAN="100">Filters <FONT ONCLICK="InfoBox ('This is the filter section', 'Here you can add filters which limits the list rows...<BR><BR>To add a new filter, selected the field which you wish to filter on in the \'\' ==[ Add new Filter ]==\'\' box,the page will then reload and you can choose to limit the results by selecting multiple options or using RegEx (' + ZydURL ('http://www.wellho.net/regex/mysql.html') + ').<BR><BR>To remove a filter, simple click on the &quot;X&quot; in the filters box.');">[?]</FONT></TH></TR>
<TR>
<?php 
if (is_array($Filter)) {
    foreach (array_keys($Filter) as $Type) {
        echo Filter($Type, $Filter[$Type]);
    }
}
?>
</TR>
<TR><TD COLSPAN="100"><SELECT NAME="Filter[]" ONCHANGE="document.List.submit ();"><OPTION VALUE="">==[ Add new filter ]==</OPTION><?php 
echo FilterOptions();
?>
</SELECT></TD></TR>
</TABLE>
</TD></TR>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="Refresh"></TD></TR>
</FORM>
</TABLE><BR>