本文整理汇总了PHP中prep函数的典型用法代码示例。如果您正苦于以下问题:PHP prep函数的具体用法?PHP prep怎么用?PHP prep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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");
}
}
}
}
}
示例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()));
}
}
示例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'])) {
示例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 = "&c1={$c1}&c2={$c2}&ac={$ac}&i={$i}&w={$w}&h={$h}&c={$c}&l={$l}&f={$f}&a1={$a1}&a2={$a2}&f1={$f1}&f2={$f2}&b={$bg}";
echo $cformsSettings['global']['cforms_root'] . '/cforms-captcha.php?ts=' . $no . str_replace('&', '&', $captcha_uri);
}
示例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;
//.........这里部分代码省略.........
示例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}";
}
}
示例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']) . ",
示例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);
示例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) {
示例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;
}
示例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;
}
示例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();
示例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) {
示例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;
}