本文整理汇总了PHP中db_shift函数的典型用法代码示例。如果您正苦于以下问题:PHP db_shift函数的具体用法?PHP db_shift怎么用?PHP db_shift使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_shift函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_ran
function upgrade_ran($v = false)
{
if (!$v) {
$v = upgrade_version_num();
}
return db_shift('select count(*) from sitellite_upgrade where num = ?', $v);
}
示例2: sitepoll_virtual_enable_comments
function sitepoll_virtual_enable_comments(&$obj)
{
if ($obj->enable_comments == 'no') {
return intl_get('Disabled');
}
return db_shift('select count(*) from sitepoll_comment where poll = ?', $obj->id);
}
示例3: onSubmit
function onSubmit($vals)
{
if (!$vals['group']) {
$res = db_fetch_array('select distinct first_name, last_name, email_address, address_line1, address_line2, city, state, country, zip, company, job_title, phone_number, daytime_phone, evening_phone, mobile_phone, fax_number from sitellite_form_submission');
$name = 'all';
} else {
$res = db_fetch_array('select distinct first_name, last_name, email_address, address_line1, address_line2, city, state, country, zip, company, job_title, phone_number, daytime_phone, evening_phone, mobile_phone, fax_number from sitellite_form_submission where form_type = ?', $vals['group']);
$name = preg_replace('/[^a-z0-9]+/', '-', strtolower(db_shift('select name from sitellite_form_type where id = ?', $vals['group'])));
}
set_time_limit(0);
header('Cache-control: private');
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename=' . $name . '-' . date('Y-m-d') . '.csv');
echo "First Name,Last Name,Email Address,Address Line 1,Address Line 2,City,State,Country,Zip,Company,Job Title,Phone Number,Daytime Phone,Evening Phone,Mobile Phone,Fax Number\n";
foreach ($res as $row) {
$r = (array) $row;
foreach (array_keys($r) as $k) {
$r[$k] = str_replace('"', '""', $r[$k]);
if (strpos($r[$k], ',') !== false) {
$r[$k] = '"' . $r[$k] . '"';
}
}
echo str_replace(array("\r", "\n"), array('\\r', '\\n'), join(',', $r)) . "\n";
}
exit;
}
示例4: SitepresenterEditSlideForm
function SitepresenterEditSlideForm()
{
parent::MailForm();
$this->parseSettings('inc/app/sitepresenter/forms/edit/slide/settings.php');
page_add_script('
function cms_cancel (f) {
if (arguments.length == 0) {
window.location.href = "/index/cms-app";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/sitepresenter-app";
}
}
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
global $cgi;
page_title(intl_get('Adding Slide to Presentation') . ': ' . db_shift('select title from sitepresenter_presentation where id = ?', $cgi->presentation));
$res = db_single('select * from sitepresenter_slide where id = ?', $cgi->id);
foreach (get_object_vars($res) as $k => $v) {
$this->widgets[$k]->setValue($v);
}
}
示例5: EntryAddForm
function EntryAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/timetracker/forms/entry/add/settings.php');
$res = db_fetch('select username, firstname, lastname from sitellite_user order by lastname asc');
if (!$res) {
$res = array();
} elseif (is_object($res)) {
$res = array($res);
}
$users = array();
foreach ($res as $row) {
if (!empty($row->lastname)) {
$users[$row->username] = $row->lastname;
if (!empty($row->firstname)) {
$users[$row->username] .= ', ' . $row->firstname;
}
$users[$row->username] .= ' (' . $row->username . ')';
} else {
$users[$row->username] = $row->username;
}
}
$this->widgets['users']->setValues($users);
$this->widgets['users']->setDefault(session_username());
$this->widgets['users']->addRule('not empty', 'You must select at least one user.');
$this->widgets['started']->setDefault(date('Y-m-d H:i:s'));
$this->widgets['ended']->setDefault(date('Y-m-d H:i:s'));
global $cgi;
$this->widgets['proj_name']->setValue(db_shift('select name from timetracker_project where id = ?', $cgi->project));
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="history.go (-1); return false"';
}
示例6: SiteblogEditForm
function SiteblogEditForm()
{
parent::MailForm();
global $cgi;
$refer = $_SERVER['HTTP_REFERER'];
$this->parseSettings('inc/app/siteblog/forms/edit/settings.php');
$this->widgets['refer']->setValue($refer);
//if add is true, we're creating a blog post, otherwise we're editing a blog post
$add = isset($cgi->_key) && !empty($cgi->_key) ? false : true;
$this->widgets['status']->setValues(array('Live', 'Not Live'));
$cats = db_pairs('select id, title from siteblog_category where status = "on"');
if ($add) {
page_title('Adding a Blog Post');
$this->widgets['author']->setValue(session_username());
unset($this->widgets['icategory']);
$this->widgets['category']->setValues($cats);
} else {
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteblog_post');
$document = $rex->getCurrent($cgi->_key);
page_title('Editing a Blog Post');
//populate fields
$this->widgets['subject']->setValue($document->subject);
$this->widgets['author']->setValue($document->author);
$this->widgets['status']->setValue($document->status);
unset($this->widgets['category']);
$catname = db_shift('select title from siteblog_category where id = ?', $document->category);
$this->widgets['icategory']->setValue($catname);
$this->widgets['oldcat']->setValue($document->category);
$this->widgets['body']->setValue($document->body);
}
}
示例7: digger_filter_user
function digger_filter_user($user)
{
$pub = db_shift('select public from sitellite_user where username = ?', $user);
if ($pub == 'yes') {
return '<a href="' . site_prefix() . '/index/sitemember-profile-action/user.' . $user . '">' . $user . '</a>';
}
return $user;
}
示例8: onSubmit
function onSubmit($vals)
{
$number = db_shift('select number from sitepresenter_slide where presentation = ? order by number desc', $vals['presentation']);
$number++;
if ($number == 0) {
$number = 1;
}
db_execute('insert into sitepresenter_slide
(id, title, presentation, number, body)
values
(null, ?, ?, ?, ?)', $vals['title'], $vals['presentation'], $number, $vals['body']);
header('Location: ' . site_prefix() . '/index/sitepresenter-slides-action?id=' . $vals['presentation']);
exit;
}
示例9: sitefaq_facet_assigned_to
function sitefaq_facet_assigned_to()
{
$res = db_shift_array('select distinct assigned_to from sitefaq_submission order by assigned_to asc');
$ret = array();
foreach ($res as $a) {
if (empty($a)) {
continue;
$ret[''] = intl_get('None');
} else {
$ret[$a] = db_shift('select concat(lastname, ", ", firstname, " (", username, ")") from sitellite_user where username = ?', $a);
}
}
return $ret;
}
示例10: onSubmit
function onSubmit($vals)
{
loader_import('siteforum.Post');
loader_import('siteforum.Filters');
loader_import('siteforum.Topic');
$p = new SiteForum_Post();
if (!session_admin()) {
$notice = 'no';
} else {
if ($vals['notice'] == 'Make this post a notice.') {
$notice = 'yes';
} else {
$notice = 'no';
}
}
$t = new SiteForum_Topic();
$topic = $t->get($vals['topic']);
if (!($res = $p->add(array('user_id' => session_username(), 'topic_id' => $vals['topic'], 'post_id' => $vals['post'], 'ts' => date('Y-m-d H:i:s'), 'subject' => $vals['subject'], 'body' => $vals['body'], 'sig' => db_shift('select sig from sitellite_user where username = ?', session_username()), 'notice' => $notice, 'sitellite_access' => $topic->sitellite_access, 'sitellite_status' => $topic->sitellite_status)))) {
page_title(intl_get('Database Error'));
echo '<p>' . intl_get('An error occurred. Please try again later.') . '</p>';
echo '<p>' . intl_get('Error Message') . ': ' . $p->error . '</p>';
return;
}
$vals['id'] = $res;
if (!empty($vals['post'])) {
$p->touch($vals['post']);
}
if ($vals['subscribe'] == 'Subscribe me to this forum thread.') {
if (!$vals['post']) {
$vals['post'] = $res;
}
db_execute('insert into siteforum_subscribe (id, post_id, user_id) values (null, ?, ?)', $vals['post'], session_username());
}
$ae = appconf('admin_email');
if ($ae) {
@mail($ae, intl_get('Forum Posting Notice'), template_simple('post_email.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain());
}
$exempt = explode(',', $ae);
$res = db_fetch_array('select distinct u.email, u.username from sitellite_user u, siteforum_subscribe s where s.user_id = u.username and s.post_id = ?', $vals['post']);
foreach ($res as $row) {
if (in_array($row->email, $exempt)) {
continue;
}
$vals['user_id'] = $row->username;
@mail($row->email, intl_get('Forum Posting Notice'), template_simple('post_email_subscriber.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain());
}
page_title(intl_get('Message Posted'));
echo template_simple('post_submitted.spt', $vals);
}
示例11: digger_has_voted
function digger_has_voted($id)
{
if (!session_valid()) {
return false;
}
// can't vote on own stories
if (db_shift('select count(*) from digger_linkstory where id = ? and user = ?', $id, session_username())) {
return true;
}
// voted already
if (db_shift('select count(*) from digger_vote where story = ? and user = ?', $id, session_username())) {
return true;
}
return false;
}
示例12: getList
function getList($user = false)
{
if (!$user) {
$user = session_username();
}
$res = db_fetch('select * from sitellite_msg_category where user = ? order by name asc', $user);
if (!$res) {
$this->error = db_error();
$res = array();
} elseif (is_object($res)) {
$res = array($res);
}
foreach (array_keys($res) as $k) {
$res[$k]->count = db_shift('select count(*) from sitellite_msg_recipient where status != "trash" and type = "user" and user = ? and category = ?', $user, $res[$k]->name);
}
return $res;
}
示例13: onSubmit
function onSubmit($vals)
{
// 1. add author if necessary
if (!db_shift('select * from sitellite_news_author where name = ?', $vals['author'])) {
db_execute('insert into sitellite_news_author (name) values (?)', $vals['author']);
}
// 2. submit story as 'draft'
loader_import('cms.Versioning.Rex');
$rex = new Rex('sitellite_news');
$res = $rex->create(array('title' => $vals['title'], 'author' => $vals['author'], 'category' => $vals['category'], 'summary' => $vals['summary'], 'body' => $vals['body'], 'date' => date('Y-m-d'), 'sitellite_status' => 'draft', 'sitellite_access' => 'public'), 'Story submission.');
$vals['id'] = $res;
// 3. email notification
@mail(appconf('submissions'), 'News Submission Notice', template_simple('submission_email.spt', $vals));
// 4. thank you screen
page_title(intl_get('Thank You!'));
echo template_simple('submissions.spt');
}
示例14: onSubmit
function onSubmit($vals)
{
if (!db_shift('select count(*) from sitellite_homepage where user = ?', session_username())) {
if (!db_execute('insert into sitellite_homepage (user, title, template, body) values (?, ?, ?, ?)', session_username(), $vals['title'], $vals['template'], $vals['body'])) {
page_title(intl_get('An Error Occurred'));
echo '<p>' . intl_get('Error') . ': ' . db_error() . '</p>';
return;
}
} else {
if (!db_execute('update sitellite_homepage set title = ?, template = ?, body = ? where user = ?', $vals['title'], $vals['template'], $vals['body'], session_username())) {
page_title(intl_get('An Error Occurred'));
echo '<p>' . intl_get('Error') . ': ' . db_error() . '</p>';
return;
}
}
page_title(intl_get('Changes Saved'));
echo '<p><a href="' . site_prefix() . '/index/sitemember-app">' . intl_get('Return to member home.') . '</a></p>';
}
示例15: onSubmit
function onSubmit($vals)
{
$header = 'Location: ' . site_prefix() . '/index/siteblog-view-action/head.on/complex.on';
if ($vals['author'] != '0') {
$header .= '/author.' . $vals['author'];
}
if ($vals['year'] != 0) {
$header .= '/year.' . $vals['year'];
}
if ($vals['month'] != 0) {
$header .= '/month.' . $vals['month'];
}
if ($vals['category'] != 0) {
$header .= '/category.' . $vals['category'];
$header .= '/title.' . siteblog_filter_link_title(db_shift('select title from siteblog_category where id = ?', $vals['category']));
}
header($header);
exit;
}