本文整理汇总了PHP中db_save函数的典型用法代码示例。如果您正苦于以下问题:PHP db_save函数的具体用法?PHP db_save怎么用?PHP db_save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_quote
function save_quote($data)
{
if (!is_admin()) {
return;
}
$table = "ez_quotes";
return db_save($table, $data);
}
示例2: update_wrapper_730
function update_wrapper_730()
{
include '/usr/share/nginx/html/php/730_core.php';
$players = get_100_users();
if (empty($players) || !isset($players[0]['steamid']) || !is_array($players)) {
die;
}
update_730($players);
db_save('start_steamid_730', $steamid1 + 100);
}
示例3: testSimpeSave
public function testSimpeSave()
{
$save = array("content_type" => "page", "subtype" => "static", "title" => "one page", "parent" => "0", "is_deleted" => "0");
$save_post = array("content_type" => "post", "subtype" => "static", "title" => "one post", "parent" => "0", "is_deleted" => "0");
$content = db_save('content', $save);
$content2 = db_save('content', $save);
$content3 = db_save('content', $save);
$content4 = db_save('content', $save);
$content5 = db_save('content', $save_post);
$content6 = db_save('content', $save_post);
$this->assertTrue(true, !$content);
$this->assertTrue(true, !$content2);
$this->assertTrue(true, $content != $content2);
$this->assertTrue(true, $content2 != $content3);
$this->assertTrue(true, $content3 != $content4);
$this->assertTrue(true, $content4 != $content5);
$this->assertTrue(true, $content5 != $content6);
}
示例4: testLimitAndPaging
public function testLimitAndPaging()
{
$add_page = db_save('content', $this->save);
$add_page = db_save('content', $this->save);
$add_page = db_save('content', $this->save);
$add_page = db_save('content', $this->save);
$pages_count = db_get('content', 'limit=2&count_paging=1');
$first_page = db_get('content', 'limit=2');
$second_page = db_get('content', 'limit=2¤t_page=2');
$first_page_items = count($first_page);
$second_page_items = count($second_page);
$ids_on_first_page = array();
foreach ($first_page as $item) {
$this->assertTrue(isset($item['id']));
$ids_on_first_page[] = $item['id'];
}
foreach ($second_page as $item) {
$this->assertTrue(isset($item['id']));
$this->assertFalse(in_array($item['id'], $ids_on_first_page));
}
$this->assertEquals($first_page_items, $second_page_items, 'First page item count: ' . $first_page_items . ', second page item count: ' . $second_page_items);
$this->assertTrue(intval($pages_count) > 1);
// @todo: fix the count_paging param to return integer $this->assertTrue(is_int($pages_count));
}
示例5: langTranslatePost
<?php
include '../../include.php';
if ($posting) {
langTranslatePost('title,description');
db_save('pages');
url_change_post('./');
}
echo drawTop();
$f = new form('pages', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
$f->set_field(array('type' => 'textarea', 'class' => 'tinymce', 'name' => 'description' . langExt(), 'label' => getString('description')));
$f->unset_fields('url,isSecure');
if (url_id('module_id')) {
$f->set_field(array('type' => 'hidden', 'name' => 'module_id', 'value' => $_GET['module_id']));
} else {
$f->unset_fields('module_id');
}
if (url_id('modulette_id')) {
$f->set_field(array('type' => 'hidden', 'name' => 'modulette_id', 'value' => $_GET['modulette_id']));
} else {
$f->unset_fields('modulette_id');
}
if (isset($_GET['url'])) {
$f->set_field(array('type' => 'hidden', 'name' => 'url', 'value' => $_GET['url']));
}
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f);
echo $f->draw();
echo drawBottom();
示例6: error_debug
<?php
include '../include.php';
if ($posting) {
error_debug('user is posting', __FILE__, __LINE__);
if ($uploading) {
list($_POST['content'], $_POST['type_id']) = file_get_uploaded('content', 'docs_types');
}
langTranslatePost('title,description');
$id = db_save('docs');
//debug();
db_checkboxes('categories', 'docs_to_categories', 'documentID', 'categoryID', $id);
if (getOption('channels')) {
db_checkboxes('channels', 'docs_to_channels', 'doc_id', 'channel_id', $id);
}
url_change('info.php?id=' . $id);
}
if (url_id()) {
$d = db_grab('SELECT title, description FROM docs WHERE id = ' . $_GET['id']);
$pageAction = getString('edit');
} else {
$pageAction = getString('add_new');
}
echo drawTop();
//load code for JS
$extensions = array();
$doctypes = array();
$types = db_query('SELECT description, extension FROM docs_types ORDER BY description');
while ($t = db_fetch($types)) {
$extensions[] = '(extension != "' . $t['extension'] . '")';
$doctypes[] = ' - ' . $t['description'] . ' (.' . $t['extension'] . ')';
示例7: file_type
<?php
include '../../include.php';
if ($posting) {
if ($_GET['doc_id'] == 'new') {
$_GET['doc_id'] = false;
}
if ($uploading) {
$_POST['extension'] = file_type($_FILES['content']['name']);
$_POST['content'] = file_get_uploaded('content');
}
$id = db_save('dl_docs', @$_GET['doc_id']);
db_checkboxes('categories', 'dl_docs_to_categories', 'doc_id', 'category_id', $id);
url_drop('id');
} elseif (url_action('delete')) {
db_delete('dl_docs');
url_drop('id,action');
}
echo drawTop();
if (!empty($_GET['doc_id'])) {
if ($_GET['doc_id'] == 'new') {
$_GET['doc_id'] = false;
}
$f = new form('dl_docs', @$_GET['doc_id'], ($_GET['doc_id'] ? 'Edit' : 'Add') . ' Document');
$f->set_title_prefix($page['breadcrumbs']);
$f->set_field(array('name' => 'title', 'label' => getString('title'), 'type' => 'text'));
$f->unset_fields('extension');
$f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max()));
$f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'dl_categories', 'option_title' => 'title', 'linking_table' => 'dl_docs_to_categories', 'object_id' => 'doc_id', 'option_id' => 'category_id'));
echo $f->draw();
} else {
示例8: langTranslatePost
<?php
include "../../include.php";
if ($posting) {
langTranslatePost('title');
$id = db_save('modules');
url_drop('id');
}
echo drawTop();
if (url_id()) {
//form
$f = new form('modules', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
langUnsetFields($f, 'title');
langTranslateCheckbox($f);
echo $f->draw();
} else {
//modules list
$t = new table('modules', drawHeader());
$t->set_column('is_selected', 'd', ' ');
$t->set_column('draggy', 'd', ' ');
$t->set_column('title', 'l', getString('title'));
$t->set_column('pages', 'r');
$result = db_table('SELECT m.id, m.title' . langExt() . ' title, m.is_active, (SELECT COUNT(*) FROM pages p WHERE p.module_id = m.id AND p.modulette_id IS NULL) pages FROM modules m ORDER BY m.precedence');
$t->set_draggable('draggy');
foreach ($result as &$r) {
$r['is_selected'] = draw_form_checkbox('foo', $r['is_active'], false, 'ajax_set(\'modules\', \'is_active\', ' . $r['id'] . ', ' . abs($r['is_active'] - 1) . ');');
$r['draggy'] = draw_img('/images/icons/move.png');
$r['title'] = draw_link('./?id=' . $r['id'], $r['title']);
$r['pages'] = draw_link('pages.php?module_id=' . $r['id'], format_quantitize($r['pages'], 'page'));
}
示例9: apiKeyBox
function apiKeyBox()
{
if (admin_password() && isset($_POST['apikeyfield']) && isset($_POST['apikeysubmit'])) {
db_save('akey', $_POST['apikeyfield']);
}
$apikey = db_load('akey');
echo '<div class="col2 rt"><h2>Api Key:</h2><br><form action="', $_SERVER['PHP_SELF'], '" method=post><input name="apikeyfield" type="text" placeholder="', $apikey, '"><br><input name="pass" type="password" class="ddinput"><input type=submit name=apikeysubmit value=apikeysubmit></form></div>';
}
示例10: db_save
<?php
include "../../include.php";
if ($posting) {
$id = db_save("queries");
url_change("./");
}
echo drawTop();
if (isset($_GET["id"])) {
$r = db_grab("SELECT \n\t\t\tq.databaseID,\n\t\t\td.dbname,\n\t\t\tq.name,\n\t\t\tq.description,\n\t\t\tq.query,\n\t\t\tq.is_active\n\t\tFROM queries q \n\t\tJOIN queries_databases d ON d.id = q.databaseID\n\t\tWHERE q.id = " . $_GET["id"]);
/*db_switch($r["dbname"]);
db_query($r["query"], false, true);
db_switch($_josh["db"]["database"]);*/
} else {
$r["is_active"] = 1;
}
$form = new intranet_form();
$form->addRow("hidden", "", "is_active", $r["is_active"]);
$form->addRow("select", "Database", "databaseID", "SELECT id, dbname from queries_databases order by dbname", @$r["databaseID"], true);
$form->addRow("itext", "Name", "name", @$r["name"], "", false, 50);
$form->addRow("textarea", "Description", "description", @$r["description"]);
$form->addRow("textarea-plain", "Query", "query", @$r["query"]);
$form->addRow("submit", "Save Changes");
if (isset($_GET["id"])) {
$form->draw("<a href='/queries/'>Database Queries</a> > Edit Query");
} else {
$form->draw("Add New Query");
}
echo drawBottom();
示例11: format_post_bits
<?php
include '../../include.php';
if ($posting) {
format_post_bits('is_selected');
langTranslatePost('name,description');
$id = db_save('soc_members');
url_change_post('../');
}
echo drawTop();
$f = new form('soc_members', @$_GET['id'], $page['title']);
$f->set_field(array('name' => 'name' . langExt(), 'type' => 'text', 'label' => getString('title')));
$f->set_field(array('name' => 'country_id', 'type' => 'select', 'sql' => 'SELECT id, en FROM jr_countries ORDER BY en'));
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'class' => 'tinymce', 'label' => getString('description')));
langUnsetFields($f, 'name,description');
langTranslateCheckbox($f);
$f->set_title_prefix($page['breadcrumbs']);
echo $f->draw();
echo drawBottom();
示例12: db_save
<?php
include "../../include.php";
if ($posting) {
$id = db_save("web_news_blurbs");
url_change_post("../");
} elseif (url_action('delete')) {
db_delete('web_news_blurbs', $_GET['delete_id']);
url_change('../');
}
echo drawTop();
$f = new form("web_news_blurbs", @$_GET["id"]);
$f->set_title(drawHeader());
echo $f->draw();
echo drawBottom();
示例13: elseif
if ($r["statusID"] != 9) {
//open
$typeRequired = false;
} elseif (!$r["type_id"]) {
//closed, no type
$typeRequired = false;
} else {
$typeRequired = true;
}
//$page['is_admin'] = ($page['is_admin'] && ($r["departmentID"] == $_SESSION["departmentID"])) ? true : false;
if ($uploading) {
//upload an attachment
$_POST['content'] = file_get_uploaded('userfile');
$_POST['extension'] = file_ext($_FILES['userfile']['name']);
$_POST["ticketID"] = $_GET["id"];
$id = db_save('helpdesk_tickets_attachments', false);
url_change();
} elseif ($posting) {
//add a comment
//auto-assign ticket if unassigned and followup poster is an IT admin
$followupAdmin = !empty($_POST['is_admin']) ? 1 : 0;
if ($page['is_admin'] && !$followupAdmin && empty($r["ownerID"])) {
//set to it staff assigned if no status
if ($r["statusID"] == 1) {
$r["statusID"] = 2;
}
db_query('UPDATE helpdesk_tickets SET ownerID = ' . user() . ', statusID = ' . $r["statusID"] . ', updated_date = GETDATE() WHERE id = ' . $_GET['id']);
}
//insert followup
db_query('INSERT INTO helpdesk_tickets_followups (
ticketID,
示例14: error_debug
<?php
include 'include.php';
if ($posting) {
error_debug('handling bb post', __FILE__, __LINE__);
format_post_bits('is_admin');
langTranslatePost('title,description');
$id = db_save('bb_topics');
db_query('UPDATE bb_topics SET thread_date = GETDATE(), replies = (SELECT COUNT(*) FROM bb_followups WHERE topic_id = ' . $id . ') WHERE id = ' . $id);
if (getOption('channels')) {
db_checkboxes('channels', 'bb_topics_to_channels', 'topic_id', 'channel_id', $id);
}
//notification
if ($_POST['is_admin'] == '1') {
//get addresses of everyone & send with message
emailUser(db_array('SELECT email FROM users WHERE is_active = 1'), $_POST['title'], drawEmail(bbDrawTopic($id, true)));
} elseif (getOption('bb_notifypost') && getOption('channels') && getOption('languages')) {
//get addresses of everyone with indicated interests and send
$channels = array_post_checkboxes('channels');
$languages = db_table('SELECT id, code FROM languages');
foreach ($languages as $l) {
$addresses = db_array('SELECT DISTINCT u.email FROM users u JOIN users_to_channels_prefs u2cp ON u.id = u2cp.user_id WHERE u.is_active = 1 AND u.language_id = ' . $l['id'] . ' AND u2cp.channel_id IN (' . implode(',', $channels) . ')');
$topic = db_grab('SELECT
ISNULL(u.nickname, u.firstname) firstname,
u.lastname,
t.title' . langExt($l['code']) . ' title,
t.description' . langExt($l['code']) . ' description,
y.title' . langExt($l['code']) . ' type,
t.created_date
FROM bb_topics t
LEFT JOIN bb_topics_types y ON t.type_id = y.id
示例15: langTranslatePost
<?php
include "../../include.php";
if ($posting) {
langTranslatePost('title');
$id = db_save('links');
url_drop('id');
} elseif (url_action('delete') && url_id('delete_id')) {
db_delete('links', $_GET['delete_id']);
url_drop('delete_id,action');
}
echo drawTop();
if (url_id()) {
//form
$f = new form('links', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
langUnsetFields($f, 'title');
langTranslateCheckbox($f);
echo $f->draw();
} else {
//modules list
$t = new table('links', drawHeader());
$t->set_column('draggy', 'd', ' ');
$t->set_column('title', 'l', getString('title'));
$t->set_column('delete', 'd', ' ');
$result = db_table('SELECT l.id, l.title' . langExt() . ' title FROM links l WHERE l.is_active = 1 ORDER BY l.precedence');
$t->set_draggable('draggy');
foreach ($result as &$r) {
$r['draggy'] = draw_img('/images/icons/move.png');
$r['title'] = draw_link('links.php?id=' . $r['id'], $r['title']);
$r['delete'] = drawColumnDelete($r['id']);