本文整理汇总了PHP中DbConn::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConn::query方法的具体用法?PHP DbConn::query怎么用?PHP DbConn::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbConn
的用法示例。
在下文中一共展示了DbConn::query方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: id
function id($verify = FALSE)
{
$id = get_cookie('admin_id');
if (!$id) {
return FALSE;
}
// If no verification is necessary, we're good to go
if (!$verify) {
return $id;
}
$token = get_cookie('admin_token');
if (!$token) {
return FALSE;
}
$db = new DbConn();
$result = $db->query('select * from admins where id = ?', $id);
$admin = $result->next();
if (!$admin) {
return FALSE;
}
if ($admin->token != $token) {
return FALSE;
}
return $id;
}
示例2: connect
function connect()
{
$this->db = DbConn::getInstance();
$this->org_chart = array();
// Cache org_chart group
$query = " SELECT oc.id_dir, oc.translation, oct.idst_oc, oct.idst_ocd " . " FROM %adm_org_chart AS oc " . "\tJOIN %adm_org_chart_tree AS oct " . "\t\tON (oc.id_dir = oct.idOrg) " . " WHERE lang_code = '" . Lang::get() . "'";
$result = $this->db->query($query);
while ($o = $this->db->fetch_obj($result)) {
$name_index = strtolower(trim(addslashes($o->translation)));
$this->org_chart[$name_index] = $o;
}
$tmp = $this->aclm->getGroup(false, '/oc_0');
$this->root_oc = $tmp[0];
$tmp = $this->aclm->getGroup(false, '/ocd_0');
$this->root_ocd = $tmp[0];
// Cache user levels
$this->levels = $this->aclm->getAdminLevels();
$this->preference = new AdminPreference();
// Cache admin profiles
$this->m_ar = new AdminrulesAdm();
$tmp = $this->m_ar->getGroupForDropdown();
unset($tmp[0]);
$this->admin_profiles = array_flip($tmp);
// Cache public admin profiles
$this->m_ap = new PublicadminrulesAdm();
$tmp = $this->m_ap->getGroupForDropdown();
unset($tmp[0]);
$this->public_profiles = array_flip($tmp);
return true;
}
示例3: get_users_by_state
function get_users_by_state($state)
{
$db = new DbConn();
if (!is_array($state)) {
$state = array($state);
}
return $db->query('select * from users where status in ?', $state);
}
示例4: get_log_events
function get_log_events($userId = FALSE, $limit = FALSE)
{
$db = new DbConn();
$query = 'select event_log.*, users.firstname, users.lastname, admins.name as admin
from event_log left join users on event_log.userid = users.id
left join admins on event_log.adminid = admins.id';
if ($userId) {
$query = $query . ' where event_log.userid = ?';
}
$query = $query . ' order by id desc';
if ($limit) {
$limit = (int) $limit;
$query = $query . " limit {$limit}";
}
if ($userId) {
return $db->query($query, $userId);
} else {
return $db->query($query);
}
}
示例5: index
function index()
{
$this->load->helper('mail');
$db = new DbConn();
$mails = $db->query('select * from mails_scheduled where due <= NOW()');
while ($mail = $mails->next()) {
$user_id = $mail->userid;
$mail_id = $mail->mailid;
$template = get_mail_template($mail_id, false);
if (!$template) {
continue;
}
send_user_mail($template, $user_id);
$db->exec('delete from mails_scheduled where id = ?', $mail->id);
}
}
示例6: show
function show($year, $month)
{
$calendar = new EventCalendar($month, $year, '+1 year');
$start = $calendar->start();
$end = $calendar->end();
$db = new DbConn();
$results = $db->query('select * from users
where status in ?
and arrivaldate is not null
and departuredate is not null
and ((arrivaldate >= ? and arrivaldate < ?)
or (departuredate >= ? and departuredate < ?))
order by arrivaldate asc', array(STATUS_ACCEPTED, STATUS_CONFIRMED), $start, $end, $start, $end);
while ($user = $results->next()) {
$calendar->addEvent("{$user->firstname} {$user->lastname}", $this->_to_date($user->arrivaldate), $this->_to_date($user->departuredate), site_url("admin/volunteers/show/{$user->id}"), $user->status != STATUS_CONFIRMED);
}
$prev = clone $start;
$prev->modify('-1 year');
$next = clone $start;
$next->modify('+1 year');
$this->load->view('admin/header');
$this->load->view('admin/calendar', array('calendar' => $calendar, 'date' => $this->_make_date($year, $month), 'prev' => $prev, 'next' => $next));
$this->load->view('admin/footer');
}
示例7: get_note
function get_note($id)
{
$db = new DbConn();
return $db->query('select notes.*, admins.name as author from notes, admins where notes.adminid = admins.id and notes.id = ?', $id);
}
示例8: DbConn
function email_history($id)
{
$user = get_user($id);
if (!$user) {
show_error('User not found', 404);
}
$db = new DbConn();
$sentMails = $db->query('select * from mails_sent, mail_template_versions where mails_sent.templateverid = mail_template_versions.id and mails_sent.userid = ? order by sent desc', $id);
$scheduledMails = $db->query('select * from mails_scheduled, mail_templates where mails_scheduled.mailid = mail_templates.id and mails_scheduled.userid = ? order by due asc', $id);
$this->load->view('admin/header', array('title' => "E-mail history - {$user->firstname} {$user->lastname}"));
$this->load->view('admin/volunteers/emails', array('user' => $user, 'sentMails' => $sentMails, 'scheduledMails' => $scheduledMails));
}
示例9: get_mail_template
function get_mail_template($template_id, $throw_on_not_found = FALSE)
{
$mail_template = FALSE;
if ($template_id) {
$db = new DbConn();
$mail_template = $db->fetch('select mtv.*, mt.role, mt.recipient, mt.allowdupes, mt.recurrence
from mail_templates as mt
left join (mail_template_versions as mtv)
on mt.id = mtv.templateid
where mt.id = ?
order by id desc', $template_id);
}
if ($throw_on_not_found && !$mail_template) {
throw new RuntimeException("Mail template #{$template_id} not found");
}
if ($mail_template) {
$attachments = $db->query('select ma.id, ma.filename, ma.size
from mail_attachments as ma, templatevers_to_attachments as t2a
where ma.id = t2a.attachmentid and t2a.templateverid = ?', $mail_template->id);
$mail_template->attachments = $attachments;
}
return $mail_template;
}
示例10: DbConn
<?php
require_once 'common.inc';
$db = new DbConn();
$mails = $db->query('select * from mails_scheduled where due <= UTC_TIMESTAMP()');
while ($mail = $mails->next()) {
$user_id = $mail->userid;
$mail_id = $mail->mailid;
$id = $mail->id;
$template = get_mail_template($mail_id, false);
if (!$template) {
continue;
}
send_user_mail($template, $user_id);
$db->exec('insert into mails_sent (userid, templateverid) values (?, ?)', $user_id, $template->id);
$db->exec('delete from mails_scheduled where id = ?', $mail->id);
}
示例11: DbConn
function preview_attachment($attachId)
{
$db = new DbConn();
$results = $db->query('select * from mail_attachments where id = ?', (int) $attachId);
if ($results->length != 1) {
show_error("File not found", 404);
}
$file = $results->next();
$filename = $file->filename;
$fileType = $file->type;
if (!download_file(make_attachment_path($attachId), $filename, $fileType)) {
show_error("File not found", 404);
}
}