当前位置: 首页>>代码示例>>PHP>>正文


PHP my_cforms_logic函数代码示例

本文整理汇总了PHP中my_cforms_logic函数的典型用法代码示例。如果您正苦于以下问题:PHP my_cforms_logic函数的具体用法?PHP my_cforms_logic怎么用?PHP my_cforms_logic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了my_cforms_logic函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __

                            $mail->body = $cformsSettings['global']['cforms_style_doctype'] . $mail->eol . "<html xmlns=\"http://www.w3.org/1999/xhtml\">" . $mail->eol . "<head><title></title></head>" . $mail->eol . "<body {$cformsSettings['global']['cforms_style']['body']}>" . $cmsghtml . "</body></html>" . $mail->eol;
                            $mail->body_alt = $cmsg;
                        } else {
                            $mail->body = $cmsg;
                        }
                        $sent = $mail->send();
                    }
                }
                if ($sent != '1') {
                    $usermessage_text = __('Error occurred while sending the auto confirmation message: ', 'cforms') . '<br />' . $smtpsettings[0] ? '<br />' . $sent : $mail->ErrorInfo;
                }
            }
            ###  redirect to a different page on suceess?
            if ($cformsSettings['form' . $no]['cforms' . $no . '_redirect'] && !$isWPcommentForm) {
                if (function_exists('my_cforms_logic')) {
                    $rp = my_cforms_logic($trackf, $cformsSettings['form' . $no]['cforms' . $no . '_redirect_page'], 'redirection');
                } else {
                    $rp = $cformsSettings['form' . $no]['cforms' . $no . '_redirect_page'];
                }
                if ($rp != '') {
                    ?>
	                <script type="text/javascript">
	                    location.href = '<?php 
                    echo $rp;
                    ?>
';
	                </script>
	                <?php 
                }
            }
        } else {
开发者ID:blocher,项目名称:oneholyname,代码行数:31,代码来源:lib_nonajax.php

示例2: cf_move_files

function cf_move_files(&$trackf, $no, $subID)
{
    global $cformsSettings, $file;
    $temp = explode('$#$', stripslashes(htmlspecialchars($cformsSettings['form' . $no]['cforms' . $no . '_upload_dir'])));
    $fileuploaddir = $temp[0];
    $inSession = strpos($subID, 'xx') !== false;
    //if( !$inSession )
    $subID_ = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $subID . '-';
    $file2 = $file;
    $i = 0;
    $_SESSION['cforms']['upload'][$no]['doAttach'] = !$cformsSettings['form' . $no]['cforms' . $no . '_noattachments'];
    ### debug
    db("... in session={$inSession}, moving files on form {$no}, tracking ID={$subID_}");
    if (is_array($file2) && isset($file2[tmp_name])) {
        foreach ($file2[tmp_name] as $tmpfile) {
            ### copy attachment to local server dir
            if (is_uploaded_file($tmpfile)) {
                $fileInfoArr = array('name' => str_replace(' ', '_', $file2['name'][$i]), 'path' => $fileuploaddir, 'subID' => $subID);
                if (function_exists('my_cforms_logic')) {
                    $fileInfoArr = my_cforms_logic(&$trackf, $fileInfoArr, 'fileDestination');
                }
                if (!array_key_exists('modified', $fileInfoArr)) {
                    $fileInfoArr['name'] = $subID_ . $fileInfoArr['name'];
                }
                $destfile = $fileInfoArr['path'] . '/' . $fileInfoArr['name'];
                move_uploaded_file($tmpfile, $destfile);
                ### debug
                db("   {$tmpfile} -> {$destfile}");
                $file[tmp_name][$i] = $destfile;
                if ($inSession) {
                    $_SESSION['cforms']['upload'][$no]['files'][] = $destfile;
                }
            }
            $i++;
        }
    }
}
开发者ID:blocher,项目名称:oneholyname,代码行数:37,代码来源:lib_aux.php

示例3: cforms


//.........这里部分代码省略.........
        require_once dirname(__FILE__) . '/lib_nonajax.php';
        $usermessage_class = $all_valid ? ' success' : ' failure';
    }
    ### called from lib_WPcomments ?
    if ($isWPcommentForm && $send2author) {
        return $all_valid;
    }
    ###
    ###
    ### paint form
    ###
    ###
    $success = false;
    ###  fix for WP Comment (loading after redirect)
    if (isset($_GET['cfemail']) && $isWPcommentForm) {
        $usermessage_class = ' success';
        $success = true;
        if ($_GET['cfemail'] == 'sent') {
            $usermessage_text = preg_replace('|\\r\\n|', '<br />', stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_success']));
        } elseif ($_GET['cfemail'] == 'posted') {
            $usermessage_text = preg_replace('|\\r\\n|', '<br />', stripslashes($cformsSettings['form' . $no]['cforms_commentsuccess']));
        }
    }
    $break = '<br />';
    $nl = "\n";
    $tab = "\t";
    $tt = "\t\t";
    $ntt = "\n\t\t";
    $nttt = "\n\t\t\t";
    ### either show info message above or below
    $usermessage_text = check_default_vars($usermessage_text, $no);
    $usermessage_text = check_cust_vars($usermessage_text, $track, $no);
    ### logic: possibly change usermessage
    if (function_exists('my_cforms_logic')) {
        $usermessage_text = my_cforms_logic($trackf, $usermessage_text, 'successMessage');
    }
    $umc = $usermessage_class != '' && $no > 1 ? ' ' . $usermessage_class . $no : '';
    ##debug
    db("User info for form #{$no}");
    ### where to show message
    if (substr($cformsSettings['form' . $no]['cforms' . $no . '_showpos'], 0, 1) == 'y') {
        $content .= $ntt . '<div id="usermessage' . $no . 'a" class="cf_info' . $usermessage_class . $umc . ' ">' . $usermessage_text . '</div>';
        $actiontarget = 'a';
    } else {
        if (substr($cformsSettings['form' . $no]['cforms' . $no . '_showpos'], 1, 1) == 'y') {
            $actiontarget = 'b';
        }
    }
    ### multi page form: overwrite $no, move on to next form
    if ($all_valid && isset($_REQUEST['sendbutton' . $no])) {
        $isMPformNext = false;
        ### default
        $oldcurrent = $no;
        if ($isMPform && isset($_SESSION['cforms']) && $_SESSION['cforms']['current'] > 0 && $cformsSettings['form' . $no]['cforms' . $no . '_mp']['mp_next'] != -1) {
            $isMPformNext = true;
            $no = check_form_name($cformsSettings['form' . $no]['cforms' . $no . '_mp']['mp_next']);
            ##debug
            db("Session active and now moving on to form #{$no}");
            ### logic: possibly change next form
            if (function_exists('my_cforms_logic')) {
                $no = my_cforms_logic($trackf, $no, "nextForm");
            }
            ### use trackf!
            $oldcurrent = $_SESSION['cforms']['current'];
            $_SESSION['cforms']['current'] = $no == '' ? 1 : $no;
            $field_count = $cformsSettings['form' . $no]['cforms' . $no . '_count_fields'];
开发者ID:saatchidgs,项目名称:ourhouse,代码行数:67,代码来源:cforms.php

示例4: cforms2_database_getentries

function cforms2_database_getentries()
{
    check_admin_referer('database_getentries');
    if (!current_user_can('track_cforms')) {
        die("access restricted.");
    }
    global $wpdb;
    $wpdb->cformssubmissions = $wpdb->prefix . 'cformssubmissions';
    $wpdb->cformsdata = $wpdb->prefix . 'cformsdata';
    ### new global settings container, will eventually be the only one!
    $cformsSettings = get_option('cforms_settings');
    $showIDs = $_POST['showids'];
    if ($showIDs != '') {
        $sortBy = isset($_POST['sortby']) && $_POST['sortby'] != '' ? $_POST['sortby'] : 'sub_id';
        $sortOrder = isset($_POST['sortorder']) && $_POST['sortorder'] === 'asc' ? 'asc' : 'desc';
        $qtype = $_POST['qtype'];
        ### get form id from name
        $query = str_replace('*', '', $_POST['query']);
        $form_ids = false;
        if ($qtype == 'form_id' && $query != '') {
            $forms = $cformsSettings['global']['cforms_formcount'];
            for ($i = 0; $i < $forms; $i++) {
                $no = $i == 0 ? '' : $i + 1;
                if (preg_match('/' . $query . '/i', $cformsSettings['form' . $no]['cforms' . $no . '_fname'])) {
                    $form_ids = $form_ids . "'{$no}',";
                }
            }
            $querystr = !$form_ids ? '$%&/' : ' form_id IN (' . substr($form_ids, 0, -1) . ')';
        } else {
            $querystr = '%' . $query . '%';
        }
        $sql = "SELECT *, form_id, ip FROM {$wpdb->cformsdata}, {$wpdb->cformssubmissions} WHERE sub_id=id ";
        $sqlargs = array();
        if ($showIDs != 'all') {
            $sub_ids = explode(',', substr($showIDs, 0, -1));
            $placeholder = implode(',', array_fill(0, count($sub_ids), '%d'));
            $sql .= "AND sub_id in ({$placeholder}) ";
            $sqlargs = array_merge($sqlargs, $sub_ids);
        }
        if ($form_ids) {
            $sql .= "AND %s ";
            $sqlargs[] = $querystr;
        } elseif ($query != '') {
            $sql .= "AND %s LIKE %s ";
            $sqlargs[] = $qtype;
            $sqlargs[] = $querystr;
        }
        $sql .= "ORDER BY %s {$sortOrder}, f_id";
        $sqlargs[] = $sortBy;
        $sql = $wpdb->prepare($sql, $sqlargs);
        $entries = $wpdb->get_results($sql);
        cforms2_dbg($sql);
        ?>

	<div id="top">
	<?php 
        if ($entries) {
            $sub_id = '';
            foreach ($entries as $entry) {
                if ($sub_id != $entry->sub_id) {
                    if ($sub_id != '') {
                        echo '</div>';
                    }
                    $sub_id = $entry->sub_id;
                    $date = mysql2date(get_option('date_format'), $entry->sub_date);
                    $time = mysql2date(get_option('time_format'), $entry->sub_date);
                    echo '<div class="showform" id="entry' . $entry->sub_id . '">' . '<table class="dataheader"><tr><td>' . __('Form:', 'cforms2') . ' </td><td class="b">' . stripslashes($cformsSettings['form' . $entry->form_id]['cforms' . $entry->form_id . '_fname']) . '</td><td class="e">(ID:' . $entry->sub_id . ')</td><td class="d">' . $time . ' &nbsp; ' . $date . '</td>' . '<td class="s">&nbsp;</td><td><a href="#" class="xdatabutton allbuttons deleteall" type="submit" id="xbutton' . $entry->sub_id . '">' . __('Delete this entry', 'cforms2') . '</a></td>' . '<td><a class="cdatabutton dashicons dashicons-dismiss" type="submit" id="cbutton' . $entry->sub_id . '" title="' . __('close this entry', 'cforms2') . '"></a></td>' . "</tr></table>\n";
                }
                $name = $entry->field_name == '' ? '' : stripslashes($entry->field_name);
                $val = $entry->field_val == '' ? '' : stripslashes($entry->field_val);
                if (strpos($name, '[*') !== false) {
                    // attachments?
                    preg_match('/.*\\[\\*(.*)\\]$/i', $name, $r);
                    $no = $r[1] == '' ? $entry->form_id : ($r[1] == 1 ? '' : $r[1]);
                    $temp = explode('$#$', stripslashes(htmlspecialchars($cformsSettings['form' . $no]['cforms' . $no . '_upload_dir'])));
                    $fileuploaddir = $temp[0];
                    $fileuploaddirurl = $temp[1];
                    $subID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->sub_id . '-';
                    if ($fileuploaddirurl == '') {
                        $fileurl = get_site_url() . substr(trailingslashit($fileuploaddir), strlen(get_home_path()) - 1);
                    } else {
                        $fileurl = trailingslashit($fileuploaddirurl);
                    }
                    $passID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->sub_id;
                    $fileInfoArr = array('name' => strip_tags($val), 'path' => $fileurl, 'subID' => $passID);
                    if (function_exists('my_cforms_logic')) {
                        $fileInfoArr = my_cforms_logic($entries, $fileInfoArr, 'fileDestinationTrackingPage');
                    }
                    if (!array_key_exists('modified', $fileInfoArr)) {
                        $fileInfoArr['name'] = $subID . $fileInfoArr['name'];
                    }
                    $fileurl = $fileInfoArr['path'] . $fileInfoArr['name'] . $_GET['format'];
                    echo '<div class="showformfield meta"><div class="L">';
                    echo substr($name, 0, strpos($name, '[*'));
                    if ($entry->field_val == '') {
                        echo '</div><div class="R">' . __('-', 'cforms2') . '</div></div>' . "\n";
                    } else {
                        echo '</div><div class="R">' . '<a href="' . $fileurl . '">' . str_replace("\n", "<br />", strip_tags($val)) . '</a>' . '</div></div>' . "\n";
                    }
                } elseif ($name == 'page') {
//.........这里部分代码省略.........
开发者ID:pabloe01,项目名称:Rawsonenmovimiento,代码行数:101,代码来源:lib_database_getentries.php

示例5: cforms_submitcomment


//.........这里部分代码省略.........
    ###
    ###  allow the user to use form data for other apps
    ###
    $trackf['id'] = $no;
    $trackf['data'] = $track;
    if (function_exists('my_cforms_action')) {
        my_cforms_action($trackf);
    }
    ###  Catch WP-Comment function | if send2author just continue
    if ($isAjaxWPcomment !== false && $track['send2author'] == '0') {
        require_once dirname(__FILE__) . '/lib_WPcomment.php';
        ###  Catch WP-Comment function: error
        if (!$WPsuccess) {
            return $segments[0] . '*$#' . substr($cformsSettings['form' . $no]['cforms' . $no . '_popup'], 1, 1) . $WPresp . '|---';
        }
    }
    ### Catch WP-Comment function
    ###  multiple recipients? and to whom is the email sent? to_one = picked recip.
    if ($isAjaxWPcomment !== false && $track['send2author'] == '1') {
        $to = $wpdb->get_results("SELECT U.user_email FROM {$wpdb->users} as U, {$wpdb->posts} as P WHERE P.ID = {$Ajaxpid} AND U.ID=P.post_author");
        $to = $replyto = $to[0]->user_email != '' ? $to[0]->user_email : $replyto;
    } else {
        if (!($to_one != -1 && $to != '')) {
            $to = $replyto = preg_replace(array('/;|#|\\|/'), array(','), stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_email']));
        }
    }
    ### from
    $frommail = check_cust_vars(stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_fromemail']), $track, $no);
    ###  T-A-F override?
    if ($isTAF == '1' && $taf_youremail && $taf_friendsemail) {
        $replyto = "\"{$taf_yourname}\" <{$taf_youremail}>";
    }
    ### logic: dynamic admin email address
    if (function_exists('my_cforms_logic')) {
        $to = my_cforms_logic($trackf, $to, 'adminTO');
    }
    ### use trackf!
    ### either use configured subject or user determined
    $vsubject = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_subject']);
    $vsubject = check_default_vars($vsubject, $no);
    $vsubject = check_cust_vars($vsubject, $track, $no);
    ###  prep message text, replace variables
    $message = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_header']);
    if (function_exists('my_cforms_logic')) {
        $message = my_cforms_logic($trackf, $message, 'adminEmailTXT');
    }
    $message = check_default_vars($message, $no);
    $message = check_cust_vars($message, $track, $no);
    ###  actual user message
    $htmlmessage = '';
    if (substr($cformsSettings['form' . $no]['cforms' . $no . '_formdata'], 2, 1) == '1') {
        $htmlmessage = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_header_html']);
        if (function_exists('my_cforms_logic')) {
            $htmlmessage = my_cforms_logic($trackf, $htmlmessage, 'adminEmailHTML');
        }
        $htmlmessage = check_default_vars($htmlmessage, $no);
        $htmlmessage = check_cust_vars($htmlmessage, $track, $no);
    }
    $mail = new cf_mail($no, $frommail, $to, $field_email, true);
    $mail->subj = $vsubject;
    $mail->char_set = 'utf-8';
    ### HTML email
    if ($mail->html_show) {
        $mail->is_html(true);
        $mail->body = "<html>" . $mail->eol . "<body>" . $htmlmessage . ($mail->f_html ? $mail->eol . $htmlformdata : '') . $mail->eol . "</body></html>" . $mail->eol;
        $mail->body_alt = $message . ($mail->f_txt ? $mail->eol . $formdata : '');
开发者ID:saatchidgs,项目名称:ourhouse,代码行数:67,代码来源:lib_ajax.php

示例6: foreach

        }
    }
}
###
### have to upload a file?
###
global $file;
$file = '';
$i = 0;
if (isset($_FILES['cf_uploadfile' . $no]) && $all_valid) {
    $file = $_FILES['cf_uploadfile' . $no];
    foreach ($file[name] as $value) {
        if (!empty($value)) {
            ### this will check if any blank field is entered
            if (function_exists('my_cforms_logic')) {
                $file[name][$i] = my_cforms_logic($_REQUEST, $_FILES['cf_uploadfile' . $no][name][$i], "filename");
            }
            $fileerr = '';
            ### A successful upload will pass this test. It makes no sense to override this one.
            if ($file['error'][$i] > 0) {
                $fileerr = $cformsSettings['global']['cforms_upload_err1'];
            }
            ### A successful upload will pass this test. It makes no sense to override this one.
            $fileext[$i] = strtolower(substr($value, strrpos($value, '.') + 1, strlen($value)));
            $allextensions = explode(',', preg_replace('/\\s/', '', strtolower($cformsSettings['form' . $no]['cforms' . $no . '_upload_ext'])));
            if ($cformsSettings['form' . $no]['cforms' . $no . '_upload_ext'] != '' && !in_array($fileext[$i], $allextensions)) {
                $fileerr = $cformsSettings['global']['cforms_upload_err5'];
            }
            ### A non-empty file will pass this test.
            if (!($file['size'][$i] > 0)) {
                $fileerr = $cformsSettings['global']['cforms_upload_err2'];
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:31,代码来源:lib_validate.php

示例7: cforms2_get_csv_tab

function cforms2_get_csv_tab($handle, $fnames, $where, $in_list, $sortBy, $sortOrder, $cformsSettings, $charset, $format = 'csv')
{
    global $wpdb;
    $results = $wpdb->get_results("SELECT ip, id, sub_date, form_id, field_name,field_val FROM {$wpdb->cformsdata},{$wpdb->cformssubmissions} WHERE sub_id=id {$where} {$in_list} ORDER BY {$sortBy} {$sortOrder}, f_id ASC");
    //TODO check SQL injection
    $br = "\n";
    $buffer = array();
    $body = '';
    $sub_id = '';
    $format = $format == "csv" ? "," : "\t";
    $ipTab = $_GET['addip'] == 'true' ? $format : '';
    $head = $_GET['header'] == 'true' ? $format . $format . $ipTab : '';
    $last_n = '';
    foreach ($results as $entry) {
        if ($entry->field_name == 'page' || strpos($entry->field_name, 'Fieldset') !== false) {
            continue;
        }
        $next_n = $entry->form_id == '' ? '1' : $entry->form_id;
        if ($sub_id != $entry->id) {
            ### new record starts
            if ($buffer[body] != '') {
                if ($_GET['header'] == 'true' && $buffer[last_n] != $buffer[last2_n]) {
                    fwrite($handle, $buffer[head] . $br . $buffer[body] . $br);
                } else {
                    fwrite($handle, $buffer[body] . $br);
                }
            }
            $buffer[body] = $body;
            ### save 1 line
            $buffer[head] = $head;
            ### save 1 line
            $buffer[last2_n] = $buffer[last_n];
            $buffer[last_n] = $last_n;
            $body = '"' . __('Form', 'cforms2') . ': ' . cforms2_enc_data($fnames[$next_n], $charset) . '"' . $format . '"' . cforms2_enc_data($entry->sub_date, $charset) . '"' . $format . ($_GET['addip'] == 'true' ? $entry->ip . $format : '');
            $head = $_GET['header'] == 'true' ? $format . $format . $ipTab : '';
            $last_n = $next_n;
            $sub_id = $entry->id;
        }
        $url = '';
        $urlTab = '';
        if ($_GET['addurl'] == 'true' && strpos($entry->field_name, '[*')) {
            preg_match('/.*\\[\\*(.*)\\]$/i', $entry->field_name, $t);
            $no = $t[1] == '' ? $entry->form_id : ($t[1] == 1 ? '' : $t[1]);
            $urlTab = $format;
            $entry->field_name = substr($entry->field_name, 0, strpos($entry->field_name, '[*'));
            $t = explode('$#$', stripslashes(htmlspecialchars($cformsSettings['form' . $no]['cforms' . $no . '_upload_dir'])));
            $fdir = $t[0];
            $fdirURL = $t[1];
            $subID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->id . '-';
            if ($fdirURL == '') {
                $plugindir = dirname(dirname(plugin_basename(__FILE__)));
                $url = plugin_dir_url(__FILE__) . substr($fdir, strpos($fdir, $plugindir) + strlen($plugindir) + 1);
            } else {
                $url = $fdirURL;
            }
            $passID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->id;
            $fileInfoArr = array('name' => strip_tags($entry->field_val), 'path' => $url, 'subID' => $passID);
            if (function_exists('my_cforms_logic')) {
                $fileInfoArr = my_cforms_logic($results, $fileInfoArr, 'fileDestinationTrackingPage');
            }
            if (!array_key_exists('modified', $fileInfoArr)) {
                $fileInfoArr['name'] = $subID . $fileInfoArr['name'];
            }
            $url = $fileInfoArr['path'] . '/' . $fileInfoArr['name'] . $format;
        }
        $head .= $_GET['header'] == 'true' ? '"' . cforms2_enc_data(stripslashes($entry->field_name), $charset) . '"' . $format . $urlTab : '';
        $body .= '"' . str_replace('"', '""', cforms2_enc_data(stripslashes($entry->field_val), $charset)) . '"' . $format . $url;
    }
    ### foreach
    ### clean up buffer
    if ($buffer[body] != '') {
        if ($_GET['header'] == 'true' && $buffer[last_n] != $buffer[last2_n]) {
            fwrite($handle, $buffer[head] . $br . $buffer[body] . $br);
        } else {
            fwrite($handle, $buffer[body] . $br);
        }
    }
    ### clean up last body
    if ($_GET['header'] == 'true' && $buffer[last_n] != $next_n) {
        fwrite($handle, $head . $br . $body . $br);
    } else {
        fwrite($handle, $body . $br);
    }
    return;
}
开发者ID:pabloe01,项目名称:Rawsonenmovimiento,代码行数:85,代码来源:lib_database_dlentries.php

示例8: cforms2


//.........这里部分代码省略.........
    }
    ### non Ajax method
    if (isset($_REQUEST['sendbutton' . $no]) || $server_upload_size_error) {
        require_once plugin_dir_path(__FILE__) . 'lib_nonajax.php';
        $usermessage_class = $all_valid ? ' success' : ' failure';
    }
    ### called from lib_WPcomments ?
    if ($isWPcommentForm && $send2author) {
        return $all_valid;
    }
    ###
    ###
    ### paint form
    ###
    ###
    $success = false;
    ###  fix for WP Comment (loading after redirect)
    if (isset($_GET['cfemail']) && $isWPcommentForm) {
        $usermessage_class = ' success';
        $success = true;
        if ($_GET['cfemail'] == 'sent') {
            $usermessage_text = preg_replace('|\\r\\n|', '<br />', stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_success']));
        } elseif ($_GET['cfemail'] == 'posted') {
            $usermessage_text = preg_replace('|\\r\\n|', '<br />', stripslashes($cformsSettings['global']['cforms_commentsuccess']));
        } else {
            $usermessage_class = ' failure';
            $success = false;
        }
    }
    ### either show info message above or below
    $usermessage_text = cforms2_check_default_vars($usermessage_text, $no);
    $usermessage_text = cforms2_check_cust_vars($usermessage_text, $track);
    ### logic: possibly change usermessage
    if (function_exists('my_cforms_logic')) {
        $usermessage_text = my_cforms_logic($trackf, $usermessage_text, 'successMessage');
    }
    $umc = $usermessage_class != '' && $no > 1 ? ' ' . $usermessage_class . $no : '';
    ##debug
    cforms2_dbg("User info for form #{$no}");
    ### where to show message
    if (substr($cformsSettings['form' . $no]['cforms' . $no . '_showpos'], 0, 1) == 'y') {
        $content .= '<div id="usermessage' . $no . 'a" class="cf_info' . $usermessage_class . $umc . ' ">' . $usermessage_text . '</div>';
        $actiontarget = 'a';
    } else {
        if (substr($cformsSettings['form' . $no]['cforms' . $no . '_showpos'], 1, 1) == 'y') {
            $actiontarget = 'b';
        }
    }
    ### multi page form: overwrite $no, move on to next form
    $oldcurrent = $no;
    if ($all_valid && isset($_REQUEST['sendbutton' . $no])) {
        $isMPformNext = false;
        ### default
        $oldcurrent = $no;
        ##debug
        cforms2_dbg("Form is all valid & sendbutton pressed.");
        if ($isMPform && isset($_SESSION['cforms']) && $_SESSION['cforms']['current'] > 0 && $cformsSettings['form' . $no]['cforms' . $no . '_mp']['mp_next'] != -1) {
            $isMPformNext = true;
            $no = cforms2_check_form_name($cformsSettings['form' . $no]['cforms' . $no . '_mp']['mp_next']);
            ##debug
            cforms2_dbg("Session active and now moving on to form #{$no}");
            ### logic: possibly change next form
            if (function_exists('my_cforms_logic')) {
                $no = my_cforms_logic($trackf, $no, "nextForm");
            }
            ### use trackf!
开发者ID:AlexKosarim,项目名称:site123321,代码行数:67,代码来源:cforms.php

示例9: cforms2_submitcomment


//.........这里部分代码省略.........
            my_cforms_action($trackf);
        } catch (Exception $exc) {
            echo $segments[0] . '*$#y' . $exc->getMessage() . '|---';
            die;
        }
    }
    $isAjaxWPcomment = substr($cformsSettings['form' . $no]['cforms' . $no . '_tellafriend'], 0, 1) === '2';
    ###  Catch WP-Comment function | if send2author just continue
    if ($isAjaxWPcomment !== false && (!isset($track['send2author']) || $track['send2author'] == '0')) {
        require_once plugin_dir_path(__FILE__) . 'lib_WPcomment.php';
        ###  Catch WP-Comment function: error
        if (!$WPsuccess) {
            echo $segments[0] . '*$#' . substr($cformsSettings['form' . $no]['cforms' . $no . '_popup'], 1, 1) . $WPresp . '|---';
            die;
        }
    }
    ### Catch WP-Comment function
    ###  multiple recipients? and to whom is the email sent? to_one = picked recip.
    if ($isAjaxWPcomment !== false && $track['send2author'] == '1') {
        $to = $wpdb->get_results($wpdb->prepare("SELECT U.user_email FROM {$wpdb->users} as U, {$wpdb->posts} as P WHERE P.ID = %d AND U.ID=P.post_author", $Ajaxpid));
        $to = $replyto = $to[0]->user_email != '' ? $to[0]->user_email : $replyto;
    } else {
        if (!($to_one != -1 && $to != '')) {
            $to = $replyto = preg_replace(array('/;|#|\\|/'), array(','), stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_email']));
        }
    }
    ### from
    $frommail = cforms2_check_cust_vars(stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_fromemail']), $track);
    ###  T-A-F override?
    if ($isTAF == '1' && $taf_youremail && $taf_friendsemail) {
        $replyto = "\"{$taf_yourname}\" <{$taf_youremail}>";
    }
    ### logic: dynamic admin email address
    if (function_exists('my_cforms_logic')) {
        $to = my_cforms_logic($trackf, $to, 'adminTO');
    }
    ### use trackf!
    ### either use configured subject or user determined
    $vsubject = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_subject']);
    if (function_exists('my_cforms_logic')) {
        $vsubject = my_cforms_logic($trackf, $vsubject, 'adminEmailSUBJ');
    }
    $vsubject = cforms2_check_default_vars($vsubject, $no);
    $vsubject = cforms2_check_cust_vars($vsubject, $track);
    ###  prep message text, replace variables
    $message = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_header']);
    if (function_exists('my_cforms_logic')) {
        $message = my_cforms_logic($trackf, $message, 'adminEmailTXT');
    }
    $message = cforms2_check_default_vars($message, $no);
    $message = cforms2_check_cust_vars($message, $track);
    ###  actual user message
    $htmlmessage = '';
    if (substr($cformsSettings['form' . $no]['cforms' . $no . '_formdata'], 2, 1) == '1') {
        $htmlmessage = stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_header_html']);
        if (function_exists('my_cforms_logic')) {
            $htmlmessage = my_cforms_logic($trackf, $htmlmessage, 'adminEmailHTML');
        }
        $htmlmessage = cforms2_check_default_vars($htmlmessage, $no);
        $htmlmessage = cforms2_check_cust_vars($htmlmessage, $track, true);
    }
    ### custom user ReplyTo handling
    if (function_exists('my_cforms_logic')) {
        $userReplyTo = my_cforms_logic($trackf, $field_email, 'ReplyTo');
    } else {
        $userReplyTo = $field_email;
开发者ID:AlexKosarim,项目名称:site123321,代码行数:67,代码来源:lib_ajax.php

示例10: getCSVTAB

function getCSVTAB($format = 'csv')
{
    global $fnames, $wpdb, $count, $temp, $where, $in_list, $sortBy, $sortOrder, $cformsSettings, $charset;
    $results = $wpdb->get_results("SELECT ip, id, sub_date, form_id, field_name,field_val FROM {$wpdb->cformsdata},{$wpdb->cformssubmissions} WHERE sub_id=id {$where} {$in_list} ORDER BY {$sortBy} {$sortOrder}, f_id ASC");
    /*
    mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
    @mysql_select_db(DB_NAME) or die( "Unable to select database");
    
     	$sql = "SELECT ip, id, sub_date, form_id, field_name,field_val FROM {$wpdb->cformsdata},{$wpdb->cformssubmissions} WHERE sub_id=id $where $in_list ORDER BY $sortBy $sortOrder, f_id ASC";
    $r = mysql_query($sql);
    */
    $br = "\n";
    $buffer = array();
    $body = '';
    $sub_id = '';
    $format = $format == "csv" ? "," : "\t";
    $ipTab = $_GET['addip'] == 'true' ? $format : '';
    $head = $_GET['header'] == 'true' ? $format . $format . $ipTab : '';
    $last_n = '';
    foreach ($results as $key => $entry) {
        ### while( $entry = mysql_fetch_array($r) ){
        if ($entry->field_name == 'page' || strpos($entry->field_name, 'Fieldset') !== false) {
            continue;
        }
        $next_n = $entry->form_id == '' ? '1' : $entry->form_id;
        if ($sub_id != $entry->id) {
            ### new record starts
            if ($buffer[body] != '') {
                if ($_GET['header'] == 'true' && $buffer[last_n] != $buffer[last2_n]) {
                    fwrite($temp, $buffer[head] . $br . $buffer[body] . $br);
                } else {
                    fwrite($temp, $buffer[body] . $br);
                }
            }
            $buffer[body] = $body;
            ### save 1 line
            $buffer[head] = $head;
            ### save 1 line
            $buffer[last2_n] = $buffer[last_n];
            $buffer[last_n] = $last_n;
            $body = '"' . __('Form', 'cforms') . ': ' . encData($fnames[$next_n]) . '"' . $format . '"' . encData($entry->sub_date) . '"' . $format . ($_GET['addip'] == 'true' ? $entry->ip . $format : '');
            $head = $_GET['header'] == 'true' ? $format . $format . $ipTab : '';
            $last_n = $next_n;
            $sub_id = $entry->id;
        }
        $url = '';
        $urlTab = '';
        if ($_GET['addurl'] == 'true' && strpos($entry->field_name, '[*')) {
            preg_match('/.*\\[\\*(.*)\\]$/i', $entry->field_name, $t);
            $no = $t[1] == '' ? $entry->form_id : ($t[1] == 1 ? '' : $t[1]);
            $urlTab = $format;
            $entry->field_name = substr($entry->field_name, 0, strpos($entry->field_name, '[*'));
            $t = explode('$#$', stripslashes(htmlspecialchars($cformsSettings['form' . $no]['cforms' . $no . '_upload_dir'])));
            $fdir = $t[0];
            $fdirURL = $t[1];
            $subID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->id . '-';
            if ($fdirURL == '') {
                $url = $cformsSettings['global']['cforms_root'] . substr($fdir, strpos($fdir, $cformsSettings['global']['plugindir']) + strlen($cformsSettings['global']['plugindir']), strlen($fdir));
            } else {
                $url = $fdirURL;
            }
            $passID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->id;
            $fileInfoArr = array('name' => strip_tags($entry->field_val), 'path' => $url, 'subID' => $passID);
            if (function_exists('my_cforms_logic')) {
                $fileInfoArr = my_cforms_logic($results, $fileInfoArr, 'fileDestinationTrackingPage');
            }
            if (!array_key_exists('modified', $fileInfoArr)) {
                $fileInfoArr['name'] = $subID . $fileInfoArr['name'];
            }
            $url = $fileInfoArr['path'] . '/' . $fileInfoArr['name'] . $format;
        }
        $head .= $_GET['header'] == 'true' ? '"' . encData(stripslashes($entry->field_name)) . '"' . $format . $urlTab : '';
        $body .= '"' . str_replace('"', '""', encData(stripslashes($entry->field_val))) . '"' . $format . $url;
    }
    ### foreach
    ### clean up buffer
    if ($buffer[body] != '') {
        if ($_GET['header'] == 'true' && $buffer[last_n] != $buffer[last2_n]) {
            fwrite($temp, $buffer[head] . $br . $buffer[body] . $br);
        } else {
            fwrite($temp, $buffer[body] . $br);
        }
    }
    ### clean up last body
    if ($_GET['header'] == 'true' && $buffer[last_n] != $next_n) {
        fwrite($temp, $head . $br . $body . $br);
    } else {
        fwrite($temp, $body . $br);
    }
    /*
    	mysql_free_result($r);
    	mysql_close();
    */
    return;
}
开发者ID:nvvetal,项目名称:water,代码行数:95,代码来源:lib_database_dlentries.php

示例11: preg_match

     // attachments?
     preg_match('/.*\\[\\*(.*)\\]$/i', $name, $r);
     $no = $r[1] == '' ? $entry->form_id : ($r[1] == 1 ? '' : $r[1]);
     $temp = explode('$#$', stripslashes(htmlspecialchars($cformsSettings['form' . $no]['cforms' . $no . '_upload_dir'])));
     $fileuploaddir = $temp[0];
     $fileuploaddirurl = $temp[1];
     $subID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->sub_id . '-';
     if ($fileuploaddirurl == '') {
         $fileurl = $cformsSettings['global']['cforms_root'] . substr($fileuploaddir, strpos($fileuploaddir, $cformsSettings['global']['plugindir']) + strlen($cformsSettings['global']['plugindir']), strlen($fileuploaddir));
     } else {
         $fileurl = $fileuploaddirurl;
     }
     $passID = $cformsSettings['form' . $no]['cforms' . $no . '_noid'] ? '' : $entry->sub_id;
     $fileInfoArr = array('name' => strip_tags($val), 'path' => $fileurl, 'subID' => $passID);
     if (function_exists('my_cforms_logic')) {
         $fileInfoArr = my_cforms_logic($results, $fileInfoArr, 'fileDestinationTrackingPage');
     }
     if (!array_key_exists('modified', $fileInfoArr)) {
         $fileInfoArr['name'] = $subID . $fileInfoArr['name'];
     }
     $fileurl = $fileInfoArr['path'] . '/' . $fileInfoArr['name'] . $format;
     echo '<div class="showformfield meta"><div class="L">';
     echo substr($name, 0, strpos($name, '[*'));
     if ($entry->field_val == '') {
         echo '</div><div class="R">' . __('-', 'cforms') . '</div></div>' . "\n";
     } else {
         echo '</div><div class="R">' . '<a href="' . $fileurl . '">' . str_replace("\n", "<br />", strip_tags($val)) . '</a>' . '</div></div>' . "\n";
     }
 } elseif ($name == 'page') {
     // special field: page
     echo '<div class="showformfield meta"><div class="L">';
开发者ID:nvvetal,项目名称:water,代码行数:31,代码来源:lib_database_getentries.php


注:本文中的my_cforms_logic函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。