本文整理汇总了PHP中or_query函数的典型用法代码示例。如果您正苦于以下问题:PHP or_query函数的具体用法?PHP or_query怎么用?PHP or_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了or_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orsee_session_gc
function orsee_session_gc($aMaxLifeTime)
{
site__database_config();
if (!isset($aMaxLifeTime) || !$aMaxLifeTime) {
$aMaxLifeTime = 60 * 60;
}
$pars = array(':aMaxLifeTime' => $aMaxLifeTime);
$query = "DELETE FROM " . table('http_sessions') . " WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(LastUpdated) > :aMaxLifeTime";
or_query($query, $pars);
return true;
}
示例2: subpools__get_subpools
function subpools__get_subpools()
{
global $preloaded_subpools;
if (is_array($preloaded_subpools) && count($preloaded_subpools) > 0) {
return $preloaded_subpools;
} else {
$subpools = array();
$query = "SELECT *\n \t\t\tFROM " . table('subpools') . " \n \t\t\tORDER BY subpool_id";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$subpools[$line['subpool_id']] = $line;
}
$preloaded_subpools = $subpools;
return $subpools;
}
}
示例3: laboratories__get_laboratories
function laboratories__get_laboratories($tlang = "")
{
if (!$tlang) {
global $lang;
$tlang = lang('lang');
}
$labs = array();
$query = "SELECT * FROM " . table('lang') . " WHERE content_type='laboratory'\n ORDER BY order_number ";
$result = or_query($query);
while ($lab = pdo_fetch_assoc($result)) {
$tlab = array();
$tlab['lab_name'] = laboratories__strip_lab_name(stripslashes($lab[lang('lang')]));
$tlab['lab_address'] = laboratories__strip_lab_address(stripslashes($lab[lang('lang')]));
$labs[$lab['content_name']] = $tlab;
}
return $labs;
}
示例4: options__save_item_order
function options__save_item_order($item_type, $order_array, $details = array())
{
$pars = array(':item_type' => $item_type);
$query = "DELETE FROM " . table('objects') . "\n WHERE item_type= :item_type";
$done = or_query($query, $pars);
$pars = array();
foreach ($order_array as $k => $v) {
if (isset($details[$v]) && is_array($details[$v])) {
$detstr = property_array_to_db_string($details[$v]);
} else {
$detstr = '';
}
$pars[] = array(':item_type' => $item_type, ':item_name' => $v, ':order_number' => $k, ':item_details' => $detstr);
}
$query = "INSERT INTO " . table('objects') . "\n SET order_number = :order_number,\n item_type = :item_type,\n item_name = :item_name,\n item_details = :item_details";
$done = or_query($query, $pars);
return $done;
}
示例5: lang
$header = lang('delete_email_mailbox');
$headervar = lang('lang');
$reset_part_field = "";
$deletion_message = lang('email_mailbox_deleted');
break;
}
echo '<center>';
if ($reallydelete) {
$pars = array(':id' => $id);
$query = "DELETE FROM " . table('lang') . "\n WHERE lang_id= :id";
$result = or_query($query, $pars);
// there should be a miore sophisticarted way of doing this
if ($reset_part_field) {
$pars = array(':content_name' => $titem['content_name']);
$query = "UPDATE " . table('participants') . "\n SET " . $reset_part_field . "='0'\n WHERE " . $reset_part_field . "= :content_name";
$result = or_query($query, $pars);
}
message($deletion_message);
log__admin($item . "_delete", "lang_id:" . $titem['content_type'] . ',' . $titem['content_name']);
redirect('admin/lang_item_main.php?item=' . $item);
}
}
if ($proceed) {
// form
echo ' <CENTER>
<TABLE class="or_formtable">
<TR><TD colspan=2>
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . $header . ' - ' . $titem[$headervar] . '
</TD>
示例6: copy_table
function copy_table($table, $idvar, $cond = "", $delete = true)
{
global $do_delete, $do_insert, $new_db_name, $old_db_name;
$dquery = "DELETE FROM " . $new_db_name . "." . table($table) . "";
if ($do_delete && $delete) {
$done = or_query($dquery);
}
$squery = "SELECT * FROM " . $old_db_name . "." . table($table);
if ($cond) {
$squery .= ' ' . $cond;
}
$result = or_query($squery);
while ($line = pdo_fetch_assoc($result)) {
$line = convert_array_to_UTF8($line);
if ($do_insert) {
$done = orsee_db_save_array($line, $table, $line[$idvar], $idvar);
}
}
}
示例7: lang__load_lang_cat
function lang__load_lang_cat($content_type, $language = "")
{
global $lang, $preloaded_lang_cats;
if (!$language) {
$language = lang('lang');
}
if (isset($preloaded_lang_cats[$content_type][$language]) && is_array($preloaded_lang_cats[$content_type][$language]) && count($preloaded_lang_cats[$content_type][$language]) > 0) {
return $preloaded_lang_cats[$content_type][$language];
} else {
$cat = array();
$pars = array(':content_type' => $content_type);
$query = "SELECT content_name, " . $language . " as content_value\n FROM " . table('lang') . " WHERE content_type= :content_type";
$result = or_query($query, $pars);
while ($line = pdo_fetch_assoc($result)) {
$cat[$line['content_name']] = stripslashes($line['content_value']);
}
$preloaded_lang_cats[$content_type][$language] = $cat;
return $cat;
}
}
示例8: payments__get_default_budget
function payments__get_default_budget($experiment = array(), $session = array())
{
$continue = true;
if ($continue) {
if (is_array($session) && isset($session['payment_budgets'])) {
$budgets = db_string_to_id_array($session['payment_budgets']);
if (count($budgets) > 0) {
$continue = false;
return $budgets[0];
}
}
}
if ($continue) {
if (is_array($experiment) && isset($experiment['payment_budgets'])) {
$budgets = db_string_to_id_array($experiment['payment_budgets']);
if (count($budgets) > 0) {
$continue = false;
return $budgets[0];
}
}
}
if ($continue) {
$budgets = payments__load_budgets(true);
ksort($budgets);
$first = true;
foreach ($budgets as $k => $budget) {
if ($first) {
return $k;
$first = false;
}
}
}
if ($continue) {
$query = "SELECT * FROM " . table('budgets') . " \n\t\t\t\tORDER BY budget_id\n\t\t\t\tLIMIT 1";
$result = or_query($query);
$line = pdo_fetch_assoc($result);
return $line['budget_id'];
}
}
示例9: admin__select_admin_type
function admin__select_admin_type($fieldname, $selected = "", $return_var = "type_name", $hide = array())
{
global $settings, $preloaded_admintypes;
$out = '';
if (!isset($preloaded_admintypes) || !is_array($preloaded_admintypes)) {
$preloaded_admintypes = array();
$query = "SELECT * from " . table('admin_types') . "\n\t\t\t\tORDER by type_name";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$preloaded_admintypes[$line['type_name']] = $line;
}
}
if (!isset($preloaded_admintypes[$selected])) {
$selected = $settings['default_admin_type'];
}
$out .= '<SELECT name="' . $fieldname . '">';
foreach ($preloaded_admintypes as $line) {
if (!in_array($line['type_id'], $hide)) {
$out .= '<OPTION value="' . $line[$return_var] . '"';
if ($line[$return_var] == $selected || $line['type_name'] == $selected) {
$out .= ' SELECTED';
}
$out .= '>' . $line['type_name'] . '</OPTION>';
}
}
$out .= '</SELECT>';
return $out;
}
示例10: pdfoutput__make_part_list
function pdfoutput__make_part_list($experiment_id, $session_id = "", $pstatus = "", $focus = "", $sort = "", $file = false, $tlang = "")
{
global $settings;
if ($tlang == "") {
global $lang;
} else {
$lang = load_language($tlang);
}
$experiment = orsee_db_load_array("experiments", $experiment_id, "experiment_id");
$pstatuses = expregister__get_participation_statuses();
if ($session_id) {
$clause = "session_id = '" . $session_id . "'";
$title = lang('registered_subjects');
} elseif (isset($pstatuses[$pstatus])) {
$clause = "pstatus_id = '" . $pstatus . "'";
if ($pstatus == 0) {
$clause .= " AND session_id != 0";
}
$title = lang('subjects_in_participation_status') . ' "' . $pstatuses[$pstatus]['internal_name'] . '"';
} elseif ($focus == 'enroled') {
$clause = "session_id != 0";
$title = lang('registered_subjects');
}
$cols = participant__get_result_table_columns('session_participants_list_pdf');
if ($session_id) {
unset($cols['session_id']);
}
// load sessions of this experiment
$pars = array(':experiment_id' => $experiment_id);
$query = "SELECT *\n\t\t\tFROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :experiment_id\n\t\t\tORDER BY session_start";
$result = or_query($query, $pars);
global $thislist_sessions;
$thislist_sessions = array();
while ($line = pdo_fetch_assoc($result)) {
$thislist_sessions[$line['session_id']] = $line;
}
// load participant data for this session/experiment
$pars = array(':experiment_id' => $experiment_id);
$select_query = "SELECT * FROM " . table('participate_at') . ", " . table('participants') . " \n\t\t\t\t\tWHERE " . table('participate_at') . ".experiment_id= :experiment_id\n\t\t\t\t\tAND " . table('participate_at') . ".participant_id=" . table('participants') . ".participant_id\n\t\t\t\t\tAND (" . $clause . ")";
$order = query__get_sort('session_participants_list_pdf', $sort);
if (!$order) {
$order = table('participants') . ".participant_id";
}
$select_query .= " ORDER BY " . $order;
// get result
$result = or_query($select_query, $pars);
$participants = array();
while ($line = pdo_fetch_assoc($result)) {
$participants[] = $line;
}
$result_count = count($participants);
// load sessions of this experiment
$pars = array(':texperiment_id' => $experiment_id);
$squery = "SELECT *\n FROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :texperiment_id \n ORDER BY session_start";
$result = or_query($squery, $pars);
$thislist_sessions = array();
while ($line = pdo_fetch_assoc($result)) {
$thislist_sessions[$line['session_id']] = $line;
}
// reorder by session date if ordered by session id
if ($sort == "session_id") {
$temp_participants = $participants;
$participants = array();
foreach ($thislist_sessions as $sid => $s) {
foreach ($temp_participants as $p) {
if ($p['session_id'] == $sid) {
$participants[] = $p;
}
}
}
}
unset($temp_participants);
// determine table title
$table_title = $experiment['experiment_public_name'];
if ($session_id) {
$table_title .= ', ' . lang('session') . ' ' . str_replace(" ", " ", session__build_name($thislist_sessions[$session_id]));
}
$table_title .= ' - ' . $title;
// determine table headings
$table_headings = participant__get_result_table_headcells_pdf($cols);
$table_data = array();
$pnr = 0;
foreach ($participants as $p) {
$pnr++;
$p['order_number'] = $pnr;
$row = participant__get_result_table_row_pdf($cols, $p);
$table_data[] = $row;
}
// prepare pdf
include_once '../tagsets/class.ezpdf.php';
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont('../tagsets/fonts/Times-Roman.afm');
$fontsize = $settings['participant_list_pdf_table_fontsize'] ? $settings['participant_list_pdf_table_fontsize'] : 10;
$titlefontsize = $settings['participant_list_pdf_title_fontsize'] ? $settings['participant_list_pdf_title_fontsize'] : 12;
$y = $pdf->ezTable($table_data, $table_headings, $table_title, array('gridlines' => 31, 'showHeadings' => 1, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'fontSize' => $fontsize, 'titleFontSize' => $titlefontsize, 'rowGap' => 1, 'colGap' => 3, 'innerLineThickness' => 0.5, 'outerLineThickness' => 1, 'maxWidth' => 800, 'width' => 800, 'protectRows' => 2));
if ($file) {
$pdffilecode = $pdf->output();
return $pdffilecode;
} else {
$pdf->ezStream(array('Content-Disposition' => 'participant_list.pdf', 'Accept-Ranges' => 0, 'compress' => 1));
//.........这里部分代码省略.........
示例11: downloads__list_experiments
function downloads__list_experiments($showsize = false, $showtype = false, $showdate = false)
{
global $lang, $color, $expadmindata;
$out = '';
$continue = true;
if (check_allow('file_view_experiment_all')) {
$experimenter_clause = '';
$pars = array();
} elseif (check_allow('file_view_experiment_my')) {
$experimenter_clause = " AND " . table('experiments') . ".experimenter LIKE :experimenter ";
$pars = array(':experimenter' => '%|' . $expadmindata['admin_id'] . '|%');
} else {
$continue = false;
}
if ($continue) {
$query = "SELECT " . table('experiments') . ".*,\n (SELECT min(session_start) from or_sessions as s1 WHERE s1.experiment_id=" . table('experiments') . ".experiment_id) as first_session_date,\n (SELECT max(session_start) from or_sessions as s2 WHERE s2.experiment_id=" . table('experiments') . ".experiment_id) as last_session_date\n FROM " . table('experiments') . "\n WHERE " . table('experiments') . ".experiment_id IN\n (SELECT DISTINCT experiment_id FROM " . table('uploads') . ")\n " . $experimenter_clause . "\n ORDER BY last_session_date DESC";
$result = or_query($query, $pars);
$experiments = array();
while ($line = pdo_fetch_assoc($result)) {
$experiments[] = $line;
}
if (count($experiments) > 0) {
$out .= '<TABLE width=100% border=0>';
$shade = true;
foreach ($experiments as $exp) {
if ($shade) {
$bgcolor = ' bgcolor="' . $color['list_shade1'] . '"';
$shade = false;
} else {
$bgcolor = ' bgcolor="' . $color['list_shade2'] . '"';
$shade = true;
}
$out .= '<TR' . $bgcolor . '><TD>';
$out .= $exp['experiment_name'] . '</TD><TD>(';
$out .= lang('from') . ' ';
if ($exp['first_session_date'] == 0) {
$out .= '???';
} else {
$out .= ortime__format(ortime__sesstime_to_unixtime($exp['first_session_date']), 'hide_time:true');
}
$out .= ' ' . lang('to') . ' ';
if ($exp['last_session_date'] == 0) {
$out .= '???';
} else {
$out .= ortime__format(ortime__sesstime_to_unixtime($exp['last_session_date']), 'hide_time:true');
}
$out .= ')</TD><TD>';
$out .= experiment__list_experimenters($exp['experimenter'], true, true);
$out .= '</TD><TD><A HREF="download_main.php?experiment_id=' . $exp['experiment_id'] . '">' . lang('show_files') . '</A>';
$out .= '</TD></TR>';
}
$out .= '</TABLE>';
}
}
return $out;
}
示例12: experimentmail__send_participant_statistics
function experimentmail__send_participant_statistics()
{
global $lang, $settings;
$now = time();
$from = $settings['support_mail'];
$headers = "From: " . $from . "\r\n";
// remember the current language for later reset
$old_lang = lang('lang');
// preload details with current language
$maillang = $old_lang;
$statistics = stats__get_textstats_for_email();
$subject = load_language_symbol('subject_pool_statistics', $maillang) . ' ' . ortime__format($now, 'hide_time:true');
// get experimenters who want to receive the statistics
$query = "SELECT *\n FROM " . table('admin') . "\n WHERE get_statistics_mail='y'\n AND disabled='n'\n ORDER BY language";
$result = or_query($query);
$i = 0;
$rec_count = pdo_num_rows($result);
while ($admin = pdo_fetch_assoc($result)) {
if ($admin['language'] != $maillang) {
$maillang = $admin['language'];
$lang = load_language($maillang);
$statistics = stats__get_textstats_for_email();
$subject = load_language_symbol('subject_pool_statistics', $maillang) . ' ' . ortime__format($now, 'hide_time:true', $maillang);
}
$mailtext = load_mail("admin_participant_statistics_mailtext", $maillang) . "\n\n" . $statistics . "\n" . experimentmail__get_admin_footer($maillang, $admin) . "\n";
$message = process_mail_template($mailtext, $admin);
$done = experimentmail__mail($admin['email'], $subject, $message, $headers);
if ($done) {
$i++;
}
}
// reset language
if ($maillang != $old_lang) {
$lang = load_language($old_lang);
}
return "statistics sent to " . $i . " out of " . $rec_count . " administrators\n";
}
示例13: expregister__get_participation_statuses
function expregister__get_participation_statuses()
{
global $participation_statuses, $lang;
if (!(is_array($participation_statuses) && count($participation_statuses) > 0)) {
$participation_statuses = array();
$query = "SELECT *\n \t\t\tFROM " . table('participation_statuses') . " \n \t\t\tORDER BY pstatus_id";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$participation_statuses[$line['pstatus_id']] = $line;
}
$query = "SELECT *\n \t\t\tFROM " . table('lang') . "\n \t\t\tWHERE content_type='participation_status_internal_name' \n \t\t\tOR content_type='participation_status_display_name'\n \t\t\tORDER BY content_name";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
if ($line['content_type'] == 'participation_status_internal_name') {
$field = 'internal_name';
} else {
$field = 'display_name';
}
$participation_statuses[$line['content_name']][$field] = $line[lang('lang')];
}
}
return $participation_statuses;
}
示例14: participant__load_participants_for_ids
function participant__load_participants_for_ids($ids = array())
{
$participants = array();
if (count($ids) > 0) {
$par_array = id_array_to_par_array($ids);
$query = "SELECT * FROM " . table('participants') . "\n WHERE participant_id IN (" . implode(',', $par_array['keys']) . ")";
$result = or_query($query, $par_array['pars']);
while ($line = pdo_fetch_assoc($result)) {
$participants[$line['participant_id']] = $line;
}
}
return $participants;
}
示例15: check_clearpixel
function check_clearpixel()
{
$return = false;
$query = "SELECT * from " . table('objects') . "\n WHERE item_type='clearpixel' AND item_name='clearpixel'";
$cp = orsee_query($query);
if (!isset($cp['item_details'])) {
$query = "INSERT IGNORE INTO " . table('objects') . "\n SET item_type='clearpixel', item_name='clearpixel', item_details='" . time() . "'";
$done = or_query($query);
$return = true;
} else {
if (time() - $cp['item_details'] > 24 * 60 * 60) {
$query = "UPDATE " . table('objects') . "\n SET item_details='" . time() . "'\n WHERE item_type='clearpixel' AND item_name='clearpixel'";
$done = or_query($query);
$return = true;
} else {
$return = false;
}
}
return $return;
}