• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP prep函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rc

function rc()
{
    $captcha = get_option('cforms_captcha_def');
    $min = prep($captcha['c1'], 4);
    $max = prep($captcha['c2'], 5);
    $src = prep($captcha['ac'], 'abcdefghijkmnpqrstuvwxyz23456789');
    $srclen = strlen($src) - 1;
    $length = mt_rand($min, $max);
    $Code = '';
    for ($i = 0; $i < $length; $i++) {
        $Code .= substr($src, mt_rand(0, $srclen), 1);
    }
    return $Code;
}
开发者ID:prabhu,项目名称:desistartups,代码行数:14,代码来源:lib_aux.php


示例2: prep

function prep(DirectoryIterator $dir)
{
    global $xml;
    global $FILES;
    foreach ($dir as $f) {
        if (!$f->isDot()) {
            if ($f->isDir()) {
                $d = "{$f->getPath()}/{$f->getFilename()}";
                file_put_contents("{$d}.metadata.properties.xml", $xml);
                prep(new DirectoryIterator($d));
            } else {
                if ($f->getExtension() != 'xml') {
                    fwrite($FILES, $f->getPath() . '/' . $f->getFilename() . "|\n");
                }
            }
        }
    }
}
开发者ID:City-of-Bloomington,项目名称:drupal-customizations,代码行数:18,代码来源:prepareSpreadsheet.php


示例3: leyka_do_donations_export

function leyka_do_donations_export()
{
    if (empty($_GET['leyka-donations-export-csv-excel'])) {
        return;
    }
    // Just in case that export will require some time:
    ini_set('max_execution_time', 99999);
    set_time_limit(99999);
    ob_start();
    $meta_query = array('relation' => 'AND');
    if (!empty($_GET['campaign'])) {
        $meta_query[] = array('key' => 'leyka_campaign_id', 'value' => (int) $_GET['campaign']);
    }
    if (!empty($_GET['payment_type'])) {
        $meta_query[] = array('key' => 'leyka_payment_type', 'value' => $_GET['payment_type']);
    }
    if (!empty($_GET['gateway_pm'])) {
        if (strpos($_GET['gateway_pm'], 'gateway__') !== false) {
            $meta_query[] = array('key' => 'leyka_gateway', 'value' => str_replace('gateway__', '', $_GET['gateway_pm']));
        } elseif (strpos($_GET['gateway_pm'], 'pm__') !== false) {
            $meta_query[] = array('key' => 'leyka_payment_method', 'value' => str_replace('pm__', '', $_GET['gateway_pm']));
        }
    }
    $args = array('post_type' => Leyka_Donation_Management::$post_type, 'post_status' => isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys(leyka()->get_donation_statuses())) ? $_GET['post_status'] : 'any', 'm' => $_GET['month-year'], 'meta_query' => $meta_query, 'posts_per_page' => 200);
    $donations = new WP_Query(apply_filters('leyka_donations_export_query_args', $args));
    $total_pages = $donations->found_posts / 200;
    $total_pages = $total_pages - (int) $total_pages > 0 ? (int) $total_pages + 1 : $total_pages;
    $posts_page = $total_pages > 0 ? 1 : 0;
    $donations = $donations->get_posts();
    require_once LEYKA_PLUGIN_DIR . 'inc/excel-writer/SimpleExcel.php';
    $excel = new SimpleExcel('csv');
    $domain = str_replace(array('http:', 'https:'), '', home_url());
    function prep($text)
    {
        return '"' . str_replace(array(';', '"'), array('', ''), $text) . '"';
    }
    if (isset($_GET['export-tech'])) {
        // Technical export mode column headings
        $excel->writer->addRow(array('hash', 'Domain', 'Org_name', 'Timestamp', 'Date', 'Email_hash', 'Donor_name hash', 'Sum', 'Currency', 'Gateway_pm', 'Donation_status', 'Campaign_title', 'Campaign_URL', 'Payment_title', 'Target_sum', 'Campaign_target_state', 'Campaign_is_finished'));
    } else {
        // Normal export mode column headings
        $excel->writer->addRow(array(apply_filters('leyka_donations_export_headers', array('ID', 'Имя донора', 'Email', 'Тип платежа', 'Способ платежа', 'Сумма', 'Дата пожертвования', 'Статус', 'Кампания'))));
    }
    while ($posts_page && $posts_page <= $total_pages) {
        // Main loop too fill the export file
        foreach ($donations as $donation) {
            $donation = new Leyka_Donation($donation);
            $campaign = new Leyka_Campaign($donation->campaign_id);
            if (isset($_GET['export-tech'])) {
                $excel->writer->addRow(array(prep(wp_hash($domain . $donation->date_timestamp . $donation->sum . $donation->id)), prep($domain), prep(leyka_options()->opt('org_full_name')), prep($donation->date_timestamp), prep(date(get_option('date_format') . ', H:i', $donation->date_timestamp)), prep(wp_hash($donation->donor_email)), prep(wp_hash($donation->donor_name)), prep((int) $donation->sum), prep($donation->currency), $donation->payment_type == 'correction' ? prep($donation->pm_id) : prep($donation->gateway_label . '-' . $donation->pm_id), prep($donation->status), prep($campaign->title), prep($campaign->url), prep($campaign->payment_title), prep((int) $campaign->target), prep($campaign->target_state), prep((int) $campaign->is_finished)));
            } else {
                $excel->writer->addRow(apply_filters('leyka_donations_export_line', array($donation->id, $donation->donor_name, $donation->donor_email, $donation->payment_type_label, $donation->payment_method_label, $donation->sum . ' ' . $donation->currency_label, $donation->date, $donation->status_label, $campaign->title)));
            }
        }
        $posts_page++;
        $args['paged'] = $posts_page;
        $donations = get_posts(apply_filters('leyka_donations_export_query_args', $args));
        wp_cache_flush();
    }
    if (isset($_GET['export-tech'])) {
        $excel->writer->setDelimiter(';');
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-tech-' . $domain . '-' . date('d.m.Y-H.i.s') . '.csv"');
        die(iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "sep=;\n" . $excel->writer->saveString()));
        //        ob_clean();
        //
        //        header('Content-type: application/vnd.ms-excel');
        //        header('Content-Transfer-Encoding: binary');
        //        header('Expires: 0');
        //        header('Pragma: no-cache');
        //        header('Content-Disposition: attachment; filename="donations-tech-'.$domain.'-'.date('d.m.Y-H.i.s').'.csv"');
        //
        //        die("sep=;\n".implode("\r\n", $file_lines));
    } else {
        $excel->writer->setDelimiter(',');
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-' . date('d.m.Y-H.i.s') . '.csv"');
        die(iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "sep=,\n" . $excel->writer->saveString()));
    }
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:88,代码来源:leyka-donations-export.php


示例4: mq

$res = mq($q);
$proj_list = array(array("id" => "0", "name" => "--"));
while ($info = mysql_fetch_array($res)) {
    $proj_list[] = array("id" => $info['id'], "name" => $info['name_ru']);
}
$smarty->assign("projects", $proj_list);
// saving filter state
if (isset($_POST['search_button'])) {
    //		if (!empty($_POST['f_name'])) {
    $_SESSION['f_name'] = prep($_POST['f_name']);
    //		}
    //		if ($_POST['f_type'] != '0') {
    $_SESSION['f_type'] = prep($_POST['f_type']);
    //		}
    //		if ($_POST['f_proj'] != '0') {
    $_SESSION['f_proj'] = prep($_POST['f_proj']);
    //		}
} else {
    if (isset($_POST['clear_button'])) {
        $_SESSION['f_name'] = '';
        $_SESSION['f_type'] = '0';
        $_SESSION['f_proj'] = '0';
    }
}
$smarty->assign("selected_page_name", $_SESSION['f_name']);
$smarty->assign("selected_page_type", $_SESSION['f_type']);
$smarty->assign("selected_project", $_SESSION['f_proj']);
// applying filter conditions
$filter_conditions = "";
$undef_filter_conditions = "";
if (!empty($_SESSION['f_name'])) {
开发者ID:roman-reva,项目名称:iec,代码行数:31,代码来源:page_list.php


示例5: get_option

} else {
    $abspath = '../../../';
}
if (file_exists($abspath . 'wp-load.php')) {
    require_once $abspath . 'wp-load.php';
} else {
    require_once $abspath . 'wp-config.php';
}
$cformsSettings = get_option('cforms_settings');
###
###  reset captcha image
###
if (isset($_POST['captcha'])) {
    $cap = $cformsSettings['global']['cforms_captcha_def'];
    $c1 = prep($cap['c1'], '3');
    $c2 = prep($cap['c2'], '5');
    $ac = prep(urlencode($cap['ac']), urlencode('abcdefghijkmnpqrstuvwxyz23456789'));
    $i = prep($cap['i'], '');
    $h = prep($cap['h'], 25);
    $w = prep($cap['w'], 115);
    $c = prep($cap['c'], '000066');
    $l = prep($cap['l'], '000066');
    $f = prep($cap['f'], 'font4.ttf');
    $a1 = prep($cap['a1'], -12);
    $a2 = prep($cap['a2'], 12);
    $f1 = prep($cap['f1'], 17);
    $f2 = prep($cap['f2'], 19);
    $bg = prep($cap['bg'], '1.gif');
    $captcha_uri = "&amp;c1={$c1}&amp;c2={$c2}&amp;ac={$ac}&amp;i={$i}&amp;w={$w}&amp;h={$h}&amp;c={$c}&amp;l={$l}&amp;f={$f}&amp;a1={$a1}&amp;a2={$a2}&amp;f1={$f1}&amp;f2={$f2}&amp;b={$bg}";
    echo $cformsSettings['global']['cforms_root'] . '/cforms-captcha.php?ts=' . $no . str_replace('&amp;', '&', $captcha_uri);
}
开发者ID:nvvetal,项目名称:water,代码行数:31,代码来源:lib_ajax_admin.php


示例6: storeExportFile

 public static function storeExportFile($original_filename, $file_content, $archiveFile = false, $dateShiftDates = false)
 {
     global $edoc_storage_option;
     ## Create the stored name of the file as it wll be stored in the file system
     $stored_name = date('YmdHis') . "_pid" . PROJECT_ID . "_" . generateRandomHash(6) . getFileExt($original_filename, true);
     $file_extension = getFileExt($original_filename);
     $mime_type = strtolower($file_extension) == 'csv' ? 'application/csv' : 'application/octet-stream';
     // If file is UTF-8 encoded, then add BOM
     // Do NOT use addBOMtoUTF8() on Stata syntax file (.do) because BOM causes issues in syntax file
     if (strtolower($file_extension) != 'do') {
         $file_content = addBOMtoUTF8($file_content);
     }
     // If Gzip enabled, then gzip the file and append filename with .gz extension
     list($file_content, $stored_name, $gzipped) = gzip_encode_file($file_content, $stored_name);
     // Get file size in bytes
     $docs_size = strlen($file_content);
     // Add file to file system
     if ($edoc_storage_option == '0') {
         // Store locally
         $fp = fopen(EDOC_PATH . $stored_name, 'w');
         if ($fp !== false && fwrite($fp, $file_content) !== false) {
             // Close connection
             fclose($fp);
         } else {
             // Send error response
             return false;
         }
         // Add file to S3
     } elseif ($edoc_storage_option == '2') {
         global $amazon_s3_key, $amazon_s3_secret, $amazon_s3_bucket;
         $s3 = new S3($amazon_s3_key, $amazon_s3_secret, SSL);
         if (!$s3->putObject($file_content, $amazon_s3_bucket, $stored_name, S3::ACL_PUBLIC_READ_WRITE)) {
             // Send error response
             return false;
         }
     } else {
         // Store using WebDAV
         require_once APP_PATH_CLASSES . "WebdavClient.php";
         require APP_PATH_WEBTOOLS . 'webdav/webdav_connection.php';
         $wdc = new WebdavClient();
         $wdc->set_server($webdav_hostname);
         $wdc->set_port($webdav_port);
         $wdc->set_ssl($webdav_ssl);
         $wdc->set_user($webdav_username);
         $wdc->set_pass($webdav_password);
         $wdc->set_protocol(1);
         // use HTTP/1.1
         $wdc->set_debug(false);
         // enable debugging?
         if (!$wdc->open()) {
             // Send error response
             return false;
         }
         if (substr($webdav_path, -1) != '/') {
             $webdav_path .= '/';
         }
         $http_status = $wdc->put($webdav_path . $stored_name, $file_content);
         $wdc->close();
     }
     ## Add file info to edocs_metadata table
     // If not archiving file in File Repository, then set to be deleted in 1 hour
     $delete_time = $archiveFile ? "" : NOW;
     // Add to table
     $sql = "insert into redcap_edocs_metadata (stored_name, mime_type, doc_name, doc_size, file_extension, project_id, \n\t\t\t\tstored_date, delete_date, gzipped) values ('" . prep($stored_name) . "', '{$mime_type}', '" . prep($original_filename) . "', \n\t\t\t\t'" . prep($docs_size) . "', '" . prep($file_extension) . "', " . PROJECT_ID . ", '" . NOW . "', " . checkNull($delete_time) . ", {$gzipped})";
     if (!db_query($sql)) {
         // Send error response
         return false;
     }
     // Get edoc_id
     $edoc_id = db_insert_id();
     ## Add to doc_to_edoc table
     // Set flag if data is date shifted
     $dateShiftFlag = $dateShiftDates ? "DATE_SHIFT" : "";
     // Set "comment" in docs table
     if (strtolower($file_extension) == 'csv') {
         $docs_comment = "Data export file created by " . USERID . " on " . date("Y-m-d-H-i-s");
     } else {
         if ($file_extension == 'sps') {
             $stats_package_name = 'Spss';
         } elseif ($file_extension == 'do') {
             $stats_package_name = 'Stata';
         } else {
             $stats_package_name = camelCase($file_extension);
         }
         $docs_comment = "{$stats_package_name} syntax file created by " . USERID . " on " . date("Y-m-d-H-i-s");
     }
     // Archive in redcap_docs table
     $sql = "INSERT INTO redcap_docs (project_id, docs_name, docs_file, docs_date, docs_size, docs_comment, docs_type, \n\t\t\t\tdocs_rights, export_file, temp) VALUES (" . PROJECT_ID . ", '" . prep($original_filename) . "', NULL, '" . TODAY . "', \n\t\t\t\t'{$docs_size}', '" . prep($docs_comment) . "', '{$mime_type}', " . checkNull($dateShiftFlag) . ", 1, \n\t\t\t\t" . checkNull($archiveFile ? "0" : "1") . ")";
     if (db_query($sql)) {
         $docs_id = db_insert_id();
         // Add to redcap_docs_to_edocs also
         $sql = "insert into redcap_docs_to_edocs (docs_id, doc_id) values ({$docs_id}, {$edoc_id})";
         db_query($sql);
     } else {
         // Could not store in table, so remove from edocs_metadata also
         db_query("delete from redcap_edocs_metadata where doc_id = {$edoc_id}");
         return false;
     }
     // Return successful response of docs_id from redcap_docs table
     return $docs_id;
//.........这里部分代码省略.........
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:101,代码来源:LongitudinalReports.php


示例7: elseif

        print "\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:11px;color:#666;padding-left:10px;'>\n\t\t\t\t\t\t\t{$lang['calendar_popup_24']} {$table_pk_label}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr></table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
    }
    print "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<br><br>\n\t\t\t\t\t<input type='submit' value='{$lang['calendar_popup_25']}' onclick=\"\n\t\t\t\t\t\tif (document.getElementById('notes').value.length < 1) {\n\t\t\t\t\t\t\talert('{$lang['calendar_popup_26']}');\n\t\t\t\t\t\t\treturn false;\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\">\n\t\t\t\t\t<br><br>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>";
    /**
     * DISPLAY CONFIRMATION THAT NEW CALENDAR EVENT WAS CREATED
     */
} elseif (!isset($_GET['cal_id']) && !empty($_POST)) {
    //If an existing record was selected, make sure record doesn't already exist in a DAG. If so, add its group_id to calendar event.
    if ($_POST['idnumber'] != "") {
        $group_id = db_result(db_query("select value from redcap_data where project_id = {$project_id} and record = '{$_POST['idnumber']}' and field_name = '__GROUPID__' limit 1"), 0);
        //If did not select a record, check if user is in DAG.
    } elseif ($user_rights['group_id'] != "") {
        $group_id = $user_rights['group_id'];
    }
    //Add event to calendar
    $sql = "insert into redcap_events_calendar (project_id, group_id, record, event_date, event_time, notes) values " . "({$project_id}, " . checkNull($group_id) . ", " . checkNull($_POST['idnumber']) . ", '{$_POST['event_date']}', " . checkNull($_POST['event_time']) . ", '" . prep($_POST['notes']) . "')";
    //Success
    if (db_query($sql)) {
        //Logging
        log_event($sql, "redcap_events_calendar", "MANAGE", $new_cal_id, calLogChange(db_insert_id()), "Create calendar event");
        //Show confirmation
        print "<div style='color:green;padding:30px 0 0 15px;margin-bottom:10px;font-weight:bold;font-size:16px;'>\n\t\t\t\t\t<img src='" . APP_PATH_IMAGES . "tick.png'>{$lang['calendar_popup_27']}<br><br><br>\n\t\t\t\t</div>";
        //Render javascript to refresh calendar underneath and close pop-up
        print "<script type='text/javascript'>\n\t\t\t\twindow.opener.location.reload();\n\t\t\t\tsetTimeout(function(){self.close();},2500);\n\t\t\t\t</script>";
        //Query failed
    } else {
        print "<p><b>{$lang['global_01']}{$lang['colon']}</b> {$lang['calendar_popup_28']}</p>";
        if (SUPER_USER) {
            print db_error() . "<br>QUERY:<br>{$sql}";
        }
    }
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:calendar_popup.php


示例8: redcap_data_quality_status

			/**
			 * we don't want to duplicate queries
			 * if the result is excluded or has a query history, ignore it
			 */
			if (!($result['exclude'] || count($history) > 0)) {
				if ($debug) {
					show_var($history, 'HISTORY', 'red');
				}
				$dr_status = 'OPEN';
				$non_rule = null;
				$response_requested = '1';
				$response = NULL;
				$drw_log = "Open data query";
				// Insert new or update existing
				$sql = "insert into redcap_data_quality_status (rule_id, non_rule, project_id, record, event_id, field_name, query_status, assigned_user_id)
				values (" . checkNull($rule_id) . ", " . checkNull($non_rule) . ", " . PROJECT_ID . ", '" . prep($result['record']) . "',
				{$result['event_id']}, " . checkNull($field) . ", " . checkNull($dr_status) . ", " . checkNull($user['ui_id']) . ")
				on duplicate key update query_status = " . checkNull($dr_status) . ", status_id = LAST_INSERT_ID(status_id)";
				if ($debug) {
					show_var($sql, 'INSERT STATUS', 'red');
				}
				if (true) {
				//if (db_query($sql)) {
					// Get cleaner_id
					$status_id = db_insert_id();
					// Get current user's ui_id
					$userInitiator = User::getUserInfo(USERID);
					// Add new row to data_resolution_log
					$sql = "insert into redcap_data_quality_resolutions (status_id, ts, user_id, response_requested,
					response, comment, current_query_status, upload_doc_id)
					values ($status_id, '" . NOW . "', " . checkNull($userInitiator['ui_id']) . ",
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:std_lab_queries.php


示例9: array

require "../system/incl.php";
$table = "page_type";
$errors = array();
$edit = false;
$weights = array();
for ($i = 1; $i < 21; $weights[] = $i++) {
}
$smarty->assign("weights", $weights);
// if submit button was pressed
if (isset($_POST['sent'])) {
    $id = prep($_POST['id']);
    $name_ru = $_POST['name_ru'];
    $name_en = $_POST['name_en'];
    $weight = prep($_POST['weight']);
    $color = prep($_POST['color']);
    // validation
    if (empty($name_ru) || empty($name_en)) {
        $errors[] = "Название не может быть пустым!";
    }
    if (count($errors) > 0) {
        if ($id > 0) {
            $edit = true;
        }
        $data['id'] = $_POST['id'];
        $data['weight'] = $_POST['weight'];
        $data['color'] = $_POST['color'];
        $data['name_ru'] = str_replace("\\'", "'", $_POST['name_ru']);
        $data['name_en'] = str_replace("\\'", "'", $_POST['name_en']);
        $smarty->assign("data", $data);
        $smarty->assign("errors", $errors);
开发者ID:roman-reva,项目名称:iec,代码行数:30,代码来源:page_type_edit.php


示例10: substr

	$dq->executeRule($rule_id);
//	$results_table = $dq->displayResultsTable($rule_info);
//	print $results_table[2];
//	print $results_table[1];
	/**
	 * cycle through rule results
	 */
	$rule_results = $dq->getLogicCheckResults();

	foreach ($rule_results AS $results) {
		foreach ($results AS $result) {
			$dag_prefix = substr(get_single_field($result['record'], $project_id, $Proj->firstEventId, 'dm_usubjid', ''), 0, 3);
			$dag_result = db_query("SELECT group_name FROM redcap_data_access_groups WHERE project_id = '$project_id' AND LEFT(group_name, 3) = '$dag_prefix'");
			if ($dag_result) {
				$dag_name = db_result($dag_result, 0, 'group_name');
				$dag_name = prep($dag_name);
			}
			/**
			 * if the result is excluded ignore it
			 */
			if ($result['exclude'] != 1) {
				$today = date('Y-m-d');
				$redcap_event_name = $Proj->getUniqueEventNames($result['event_id']);
				$check_table = array();
				$check_table_result = db_query("SELECT * FROM _target_notifications WHERE project_id = '$project_id' AND record = '{$result['record']}' AND redcap_event_name = '$redcap_event_name' AND redcap_data_access_group = '$dag_name' AND form_name = '$destination_form' AND type = 'rule' AND type_id = '$rule_id' AND action_date = '$today'");
				if ($check_table_result) {
					$check_table = db_fetch_assoc($check_table_result);
				} else {
					error_log(db_error());
				}
				if (count($check_table) == 0) {
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:send_rule_notification.php


示例11: flat_delete

/**
 * Delete entity
 *
 * @param array $item
 *
 * @return bool
 */
function flat_delete(array &$item) : bool
{
    $attrs = $item['_entity']['attr'];
    $stmt = prep('DELETE FROM %s WHERE %s = :id', $item['_entity']['tab'], $attrs['id']['col']);
    $stmt->bindValue(':id', $item['_old']['id'], db_type($attrs['id'], $item['_old']['id']));
    $stmt->execute();
    return true;
}
开发者ID:akilli,项目名称:qnd,代码行数:15,代码来源:flat.php


示例12: target_proxy_log_event

/**
 * @param $sql
 * @param $table
 * @param $event
 * @param $record
 * @param $display
 * @param string $descrip
 * @param string $change_reason
 * @param $userid
 * @return bool|mysqli_result
 *
 * This function should only be used when required, to impersonate another user for the purpose of ensuring data integrity.
 * One example of this purpose is to replicate Survey respondent input so survey functionality is maintained.
 */
function target_proxy_log_event($sql, $table, $event, $record, $display, $descrip = "", $change_reason = "", $userid = "")
{
	global $user_firstactivity, $rc_connection;

	// Pages that do not have authentication that should have USERID set to [non-user]
	$nonAuthPages = array("_cron/cirrhosis_reporting.php", "_cron/push-hcvrna-monitoring.php", "_cron/push_durations.php", "_cron/push_durations_to_repo.php", "_cron/push_svr_actual_to_pivot.php", "push_svr_actual_to_pivot.php", "_cron/update_daa.php");

	// Log the event in the redcap_log_event table
	$ts = str_replace(array("-", ":", " "), array("", "", ""), NOW);
	$page = (defined("PAGE") ? PAGE : "");
	$ip = (isset($userid) && $userid != "[Survey respondent]") ? "" : getIpAddress(); // Don't log IP for survey respondents
	$event = strtoupper($event);
	$event_id = (isset($_GET['event_id']) && is_numeric($_GET['event_id'])) ? $_GET['event_id'] : "NULL";
	$project_id = defined("PROJECT_ID") ? PROJECT_ID : 0;

	// Query
	$sql = "INSERT INTO redcap_log_event
			(project_id, ts, user, ip, page, event, object_type, sql_log, pk, event_id, data_values, description, change_reason)
			VALUES ($project_id, $ts, '" . prep($userid) . "', " . checkNull($ip) . ", '$page', '$event', '$table', " . checkNull($sql) . ",
			" . checkNull($record) . ", $event_id, " . checkNull($display) . ", " . checkNull($descrip) . ", " . checkNull($change_reason) . ")";
	$q = db_query($sql, $rc_connection);

	// FIRST/LAST ACTIVITY TIMESTAMP: Set timestamp of last activity (and first, if applicable)
	if (defined("USERID") && strpos(USERID, "[") === false) {
		// SET FIRST ACTIVITY TIMESTAMP: If this is the user's first activity to be logged in the log_event table, then log the time in the user_information table
		$sql_firstact = "";
		if ((!isset($user_firstactivity) || (isset($user_firstactivity) && empty($user_firstactivity)))) {
			$sql_firstact = ", user_firstactivity = '" . NOW . "'";
		}
		// SET LAST ACTIVITY TIMESTAMP
		$sql = "update redcap_user_information set user_lastactivity = '" . NOW . "' $sql_firstact
				where username = '" . prep(USERID) . "' limit 1";
		db_query($sql, $rc_connection);
	}

	// Return true/false success for logged event
	return $q;
}
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:52,代码来源:logging.php


示例13: checkNull

				$dr_status = 'OPEN';
				if (!$send_to_field) {
					$non_rule = NULL;
					unset($field);
				} else {
					$non_rule = 1;
					unset($rule_id);
				}
				$response_requested = '1';
				$response = NULL;
				$drw_log = "Open data query";
				// Insert new or update existing
				$status_sql = "insert into redcap_data_quality_status
				(rule_id, non_rule, project_id, record, event_id, field_name, query_status, assigned_user_id)
				values
				(" . checkNull($rule_id) . ", " . checkNull($non_rule) . ", " . PROJECT_ID . ", '" . prep($result['record']) . "', {$result['event_id']}, " . checkNull($field) . ", " . checkNull($dr_status) . ", " . $assigned_user_id . ")
				on duplicate key update query_status = " . checkNull($dr_status) . ", status_id = LAST_INSERT_ID(status_id)";
				if (!$debug) {
					if (db_query($status_sql)) {
						// Get cleaner_id
						$status_id = db_insert_id();
						// Get current user's ui_id
						$userInitiator = User::getUserInfo(USERID);
						// Add new row to data_resolution_log
						$sql = "insert into redcap_data_quality_resolutions
						(status_id, ts, user_id, response_requested, response, comment, current_query_status, upload_doc_id)
						values
						($status_id, '" . NOW . "', " . checkNull($userInitiator['ui_id']) . ", " . checkNull($response_requested) . ", " . checkNull($response) . ", " . checkNull($rule_info['name']) . ", " . checkNull($dr_status) . ", " . checkNull($_POST['upload_doc_id']) . ")";
						if (db_query($sql)) {
							// Success, so return content via JSON to redisplay with new changes made
							$res_id = db_insert_id();
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:generate_queries.php


示例14: array

         print "<div class='red' style='margin:10px 0;width:640px;'><img src='" . APP_PATH_IMAGES . "exclamation.png'> " . RCView::escape($table_pk_label) . " <b>{$_GET['id']}</b> {$lang['data_entry_08']}<br/><b>{$lang['data_entry_13']} " . RCView::escape($table_pk_label) . " {$lang['data_entry_15']}</b></div>";
     }
 }
 /***************************************************************
  ** EVENT-FORM GRID
  ***************************************************************/
 ## Query to get all Form Status values for all forms across all time-points. Put all into array for later retrieval.
 // Prefill $grid_form_status array with blank defaults
 $grid_form_status = array();
 foreach ($Proj->eventsForms as $this_event_id => $these_forms) {
     foreach ($these_forms as $this_form) {
         $grid_form_status[$this_event_id][$this_form][1] = '';
     }
 }
 // Get form statuses
 $qsql = "select distinct d.event_id, m.form_name, if(d2.value is null, '0', d2.value) as value, d2.instance\n\t\t\tfrom (redcap_data d, redcap_metadata m) left join redcap_data d2\n\t\t\ton d2.project_id = m.project_id and d2.record = d.record and d2.event_id = d.event_id\n\t\t\tand d2.field_name = concat(m.form_name, '_complete')\n\t\t\twhere d.project_id = {$project_id} and d.project_id = m.project_id and d.record = '" . prep($id) . "' and m.element_type != 'calc'\n\t\t\tand d.field_name = m.field_name and m.form_name in (" . prep_implode(array_keys($Proj->forms)) . ") and m.field_name != '{$Proj->table_pk}'";
 $q = db_query($qsql);
 $has_repeated_events = false;
 while ($row = db_fetch_array($q)) {
     if ($row['instance'] == '') {
         $row['instance'] = '1';
     } else {
         $has_repeated_events = true;
     }
     //Put time-point and form name as array keys with form status as value
     $grid_form_status[$row['event_id']][$row['form_name']][$row['instance']] = $row['value'];
 }
 // Create an array to count the max instances per event
 $instance_count = array();
 // If has repeated events, then loop through all events/forms and sort them by instance
 if ($has_repeated_events) {
开发者ID:hcv-target,项目名称:redcap_mods,代码行数:31,代码来源:advanced-grid.php


示例15: prep

$min_font_size = prep($_REQUEST['f1'], 17);
$max_font_size = prep($_REQUEST['f2'], 19);
$min_angle = prep($_REQUEST['a1'], -12);
$max_angle = prep($_REQUEST['a2'], 12);
$col_txt_type = 4;
$col = prep($_REQUEST['c'], '000066');
$col_txt_r = hexdec(substr($col, 0, 2));
$col_txt_g = hexdec(substr($col, 2, 2));
$col_txt_b = hexdec(substr($col, 4, 2));
$border = prep($_REQUEST['l'], '000066');
$border_r = hexdec(substr($border, 0, 2));
$border_g = hexdec(substr($border, 2, 2));
$border_b = hexdec(substr($border, 4, 2));
$char_padding = 2;
$output_type = 'png';
$no = prep($_REQUEST['ts'], '');
### captcha random code
$srclen = strlen($src) - 1;
$length = mt_rand($min, $max);
$turing = '';
for ($i = 0; $i < $length; $i++) {
    $turing .= substr($src, mt_rand(0, $srclen), 1);
}
$tu = $_REQUEST['i'] == 'i' ? strtolower($turing) : $turing;
setcookie('turing_string_' . $no, $_REQUEST['i'] . '+' . md5($tu), time() + 60 * 60 * 5, "/");
if ($fontUsed == 1) {
    $fontno = mt_rand(1, 34);
    $font = $fonts_dir . '/font' . $fontno . '.ttf';
} else {
    $font = $font_url;
}
开发者ID:vanie3,项目名称:sierrahr,代码行数:31,代码来源:cforms-captcha.php


示例16: create_download_all

/**
 * Created by HCV-TARGET.
 * User: kbergqui
 * Date: 2/25/14
 * Time: 9:02 AM
 */
function create_download_all($Proj, $lang, $project_id, $app_name, $app_title, $super_user, $userid, $headers, $headers_labels, $data_csv, $data_csv_labels, $field_names, $is_child=false, $chkd_flds, $table_pk, $longitudinal, $exportDags=false, $exportSurveyFields=false) {
	$dagEnum = '';
	$do_remove_identifiers = false;
	$do_date_shift = false;
	// Retrieve project data (raw & labels) and headers in CSV format
	//list ($headers, $headers_labels, $data_csv, $data_csv_labels, $field_names)
	//	= fetchDataCsv($chkd_flds, $parent_chkd_flds, false, $do_hash, $do_remove_identifiers, $useStandardCodes, $useStandardCodeDataConversion, $standardId, $standardCodeLookup, $useFieldNames, $exportDags, $exportSurveyFields, $exportSurveyFields);
	// Log the event
	//log_event("", "redcap_data", "data_export", "", str_replace("'", "", $chkd_flds) . (($parent_chkd_flds == "") ? "" : ", " . str_replace("'", "", $parent_chkd_flds)), "Export data");

	############################################################
	## PREPARE SYNTAX FILES FOR STATS PACKAGES

	# Initializing the syntax file strings
	$spss_string = "FILE HANDLE data1 NAME='data_place_holder_name' LRECL=90000.\n";
	$spss_string .= "DATA LIST FREE" . "\n\t";
	$spss_string .= "FILE = data1\n\t/";
	$sas_string = "DATA " . $app_name . ";\nINPUT ";
	$sas_format_string = "data redcap;\n\tset redcap;\n";
	$stata_string = "clear\n\n";
	$R_string = "#Clear existing data and graphics\nrm(list=ls())\n";
	$R_string .= "graphics.off()\n";
	$R_string .= "#Load Hmisc library\nlibrary(Hmisc)\n";
	$R_label_string = "#Setting Labels\n";
	$R_units_string = "\n#Setting Units\n";
	$R_factors_string = "\n\n#Setting Factors(will create new variable for factors)";
	$R_levels_string = "";
	$value_labels_spss = "VALUE LABELS ";


	// Get relevant metadata to use for syntax files
		$syntaxfile_sql = "SELECT field_name, element_validation_type, element_enum, element_type, element_label, field_units
						   FROM redcap_metadata where project_id = $project_id and field_name in ($chkd_flds) order by field_order";

	// Array that is prepended to $field_names array if fields need to be added, such as redcap_event_name or survey timestamp
	$field_names_prepend = array();
	$prev_form = "";
	$prev_field = "";

	// Loop through all fields that were exported
	$q = db_query($syntaxfile_sql);
	while ($row = db_fetch_assoc($q)) {
		// Create object for each field we loop through
		$ob = new stdClass();
		foreach ($row as $col => $val) {
			$col = strtoupper($col);
			$ob->$col = $val;
		}

		// Set values for this loop
		$this_form = $Proj->metadata[$ob->FIELD_NAME]['form_name'];

		// If surveys exist, as timestamp and identifier fields
		if ($exportSurveyFields && $prev_form != $this_form && $ob->FIELD_NAME != $table_pk && isset($Proj->forms[$this_form]['survey_id'])) {
			// Alter $meta_array
			$ob2 = new stdClass();
			$ob2->ELEMENT_TYPE = 'text';
			$ob2->FIELD_NAME = $this_form . '_timestamp';
			$ob2->ELEMENT_LABEL = 'Survey Timestamp';
			$ob2->ELEMENT_ENUM = '';
			$ob2->FIELD_UNITS = '';
			$ob2->ELEMENT_VALIDATION_TYPE = '';
			$meta_array[$ob2->FIELD_NAME] = (Object)$ob2;
		}


		if ($ob->ELEMENT_TYPE != 'checkbox') {
			// For non-checkboxes, add to $meta_array
			$meta_array[$ob->FIELD_NAME] = (Object)$ob;
		} else {
			// For checkboxes, loop through each choice to add to $meta_array
			$orig_fieldname = $ob->FIELD_NAME;
			$orig_fieldlabel = $ob->ELEMENT_LABEL;
			$orig_elementenum = $ob->ELEMENT_ENUM;
			foreach (parseEnum($orig_elementenum) as $this_value => $this_label) {
				unset($ob);
				// $ob = $meta_set->FetchObject();
				$ob = new stdClass();
				// If coded value is not numeric, then format to work correct in variable name (no spaces, caps, etc)
				if (!is_numeric($this_value)) {
					$this_value = preg_replace("/[^a-z0-9]/", "", strtolower($this_value));
				}
				// Convert each checkbox choice to a advcheckbox field (because advcheckbox has equivalent processing we need)
				// Append triple underscore + coded value
				$ob->FIELD_NAME = $orig_fieldname . '___' . $this_value;
				$ob->ELEMENT_ENUM = "0, Unchecked \\n 1, Checked";
				$ob->ELEMENT_TYPE = "advcheckbox";
				$ob->ELEMENT_LABEL = "$orig_fieldlabel (choice=" . str_replace(array("'", "\""), array("", ""), $this_label) . ")";
				$meta_array[$ob->FIELD_NAME] = (Object)$ob;
			}
		}


		if ($ob->FIELD_NAME == $table_pk) {
//.........这里部分代码省略.........
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:101,代码来源:export_functions.php


示例17: check_existing_user

function check_existing_user($ldap_user)
{
    if (User::getUserInfo($ldap_user['uid']) == false && !empty($ldap_user['mail'])) {
        global $allow_create_db_default;
        $sql = "\n\t\t\tinsert into redcap_user_information \n\t\t\t\t(username, user_email, user_firstname, user_lastname, user_creation, allow_create_db) \n\t\t\tvalues ('" . prep($ldap_user['uid']) . "', \n\t\t\t\t'" . prep($ldap_user['mail']) . "', \n\t\t\t\t'" . prep($ldap_user['sudisplaynamefirst']) . "', \n\t\t\t\t'" . prep($ldap_user['sudisplaynamelast']) . " (added via userrights)', \n\t\t\t\tNOW(), \n\t\t\t\t{$allow_create_db_default})";
        $q = db_query($sql);
        if ($q) {
            log_event($sql, "redcap_user_information", "MANAGE", $ldap_user['uid'], "username = '{$ldap_user['uid']}'", "Update user info");
        }
        return false;
    } else {
        return true;
    }
}
开发者ID:KristenLutz,项目名称:redcap-extras,代码行数:14,代码来源:redcap_custom_verify_username.php


示例18: array

		 */
		code_bodsys($project_id, $subject_id, $event_id, $event['dcv_aedecod'], $event['dcv_aebodsys'], 'dcv_aebodsys', $debug, $recode_soc);
		/**
		 * HVN_AEBODSYS
		 */
		code_bodsys($project_id, $subject_id, $event_id, $event['hvn_aedecod'], $event['hvn_aebodsys'], 'hvn_aebodsys', $debug, $recode_soc);
		/**
		 * EOT_AEBODSYS
		 */
		code_bodsys($project_id, $subject_id, $event_id, $event['eot_aedecod'], $event['eot_aebodsys'], 'eot_aebodsys', $debug, $recode_soc);
		/**
		 * CM_CMDECOD
		 */
		if (isset($event['cm_cmtrt']) && $event['cm_cmtrt'] != '') {
			$med = array();
			$med_result = db_query("SELECT DISTINCT drug_name FROM _whodrug_mp_us WHERE drug_name = '" . prep($event['cm_cmtrt']) . "'");
			if ($med_result) {
				$med = db_fetch_assoc($med_result);
				if ($event['cm_cmdecod'] == '' && isset($med['drug_name']) && $med['drug_name'] != '') {
					update_field_compare($subject_id, $project_id, $event_id, $med['drug_name'], $event['cm_cmdecod'], 'cm_cmdecod', $debug);
				}
			}
		} else {
			update_field_compare($subject_id, $project_id, $event_id, '', $event['cm_cmdecod'], 'cm_cmdecod', $debug);
		}
		/**
		 * cm_suppcm_mktstat
		 * PRESCRIPTION or OTC
		 */
		if (isset($event['cm_cmdecod']) && $event['cm_cmdecod'] != '') {
			update_field_compare($subject_id, $project_id, $event_id, get_conmed_mktg_status($event['cm_cmdecod']), $event['cm_suppcm_mktstat'], 'cm_suppcm_mktstat', $debug);
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:coding.php


示例19: leyka_do_donations_export

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP prep_app_title函数代码示例发布时间:2022-05-15
下一篇:
PHP preload_course_contexts函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap