本文整理汇总了PHP中dba_update函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_update函数的具体用法?PHP dba_update怎么用?PHP dba_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dlrd
function dlrd()
{
global $core_config;
$core_config['dlrd_limit'] = (int) $core_config['dlrd_limit'] ? (int) $core_config['dlrd_limit'] : 200;
$list = dba_search(_DB_PREF_ . '_tblDLR', '*', array('flag_processed' => 1), '', array('LIMIT' => $core_config['dlrd_limit']));
$j = 0;
for ($j = 0; $j < count($list); $j++) {
if ($id = $list[$j]['id']) {
$smslog_id = $list[$j]['smslog_id'];
$p_status = $list[$j]['p_status'];
$uid = $list[$j]['uid'];
if (dba_update(_DB_PREF_ . '_tblDLR', array('flag_processed' => 2), array('id' => $id))) {
logger_print("id:" . $id . " smslog_id:" . $smslog_id . " p_status:" . $p_status . " uid:" . $uid, 3, "dlrd");
setsmsdeliverystatus($smslog_id, $uid, $p_status);
}
}
}
}
示例2: registry_update
function registry_update($uid, $registry_group, $registry_family, $items)
{
$ret = false;
$db_table = _DB_PREF_ . '_tblRegistry';
if (is_array($items)) {
foreach ($items as $key => $val) {
$conditions = array('uid' => $uid, 'registry_group' => $registry_group, 'registry_family' => $registry_family, 'registry_key' => $key);
$values = array('c_timestamp' => strtotime(core_get_datetime()), 'registry_value' => $val);
if (dba_count($db_table, $conditions)) {
$ret[$key] = dba_update($db_table, $values, $conditions);
} else {
$ret[$key] = dba_add($db_table, array_merge($conditions, $values));
}
unset($conditions);
unset($values);
}
}
return $ret;
}
示例3: notif_update
/**
* Update notification
* @param integer $uid User ID
* @param string $id Notification ID
* @param array $data Updated data
* @return boolean
*/
function notif_update($uid, $id, $data)
{
$ret = FALSE;
$replaced = '';
$db_table = _DB_PREF_ . '_tblNotif';
$result = dba_search($db_table, '*', array('uid' => $uid, 'id' => $id));
foreach ($result[0] as $key => $val) {
$items[$key] = $data[$key] ? $data[$key] : $val;
if ($data[$key]) {
$replaced = $key . ':' . $val . ' ';
}
}
if ($items && trim($replaced)) {
if (dba_update($db_table, $items, array('id' => $id))) {
logger_print('uid:' . $uid . ' id:' . $id . ' ' . trim($replaced), 2, 'notif_update');
$ret = TRUE;
}
}
return $ret;
}
示例4: recvsmsd
function recvsmsd()
{
global $core_config;
$core_config['recvsmsd_limit'] = (int) $core_config['recvsmsd_limit'] ? (int) $core_config['recvsmsd_limit'] : 200;
$list = dba_search(_DB_PREF_ . '_tblRecvSMS', '*', array('flag_processed' => 1), '', array('LIMIT' => $core_config['recvsmsd_limit']));
$j = 0;
for ($j = 0; $j < count($list); $j++) {
if ($id = $list[$j]['id']) {
$sms_datetime = $list[$j]['sms_datetime'];
$sms_sender = $list[$j]['sms_sender'];
$message = $list[$j]['message'];
$sms_receiver = $list[$j]['sms_receiver'];
$smsc = $list[$j]['smsc'];
if (dba_update(_DB_PREF_ . '_tblRecvSMS', array('flag_processed' => 2), array('id' => $id))) {
logger_print("id:" . $id . " dt:" . core_display_datetime($sms_datetime) . " sender:" . $sms_sender . " m:" . $message . " receiver:" . $sms_receiver . " smsc:" . $smsc, 3, "recvsmsd");
recvsms_process(core_display_datetime($sms_datetime), $sms_sender, $message, $sms_receiver, $smsc);
}
}
}
}
示例5: core_csv_format
$content = core_csv_format($data);
$fn = 'credit-' . $core_config['datetime']['now_stamp'] . '.csv';
core_download($content, $fn, 'text/csv');
break;
case 'delete':
for ($i = 0; $i < $nav['limit']; $i++) {
$checkid = $_POST['checkid' . $i];
$itemid = $_POST['itemid' . $i];
if ($checkid == "on" && $itemid) {
$up = array('c_timestamp' => mktime(), 'delete_datetime' => core_get_datetime(), 'flag_deleted' => '1');
// only if users
if ($user_config['status'] == 3) {
$up['parent_uid'] = $user_config['uid'];
$up['status'] = 4;
}
dba_update($db_table, $up, array('id' => $itemid));
}
}
$ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
$_SESSION['dialog']['info'][] = _('Selected transactions has been deleted');
header("Location: " . _u($ref));
exit;
break;
case "add":
$continue = FALSE;
$uids = $_POST['uids'];
if (is_array($uids)) {
foreach ($uids as $uid) {
if ($user_config['status'] == 3) {
$parent_uid = user_getparentbyuid($uid);
if ($parent_uid == $user_config['uid']) {
示例6: themes_nav_session
$nav = themes_nav_session();
$search = themes_search_session();
$go = $_REQUEST['go'];
switch ($go) {
case 'export':
$conditions = array('in_uid' => $user_config['uid'], 'flag_deleted' => 0);
$list = dba_search(_DB_PREF_ . '_tblUser_inbox', '*', $conditions, $search['dba_keywords']);
$data[0] = array(_('User'), _('Time'), _('From'), _('Message'));
for ($i = 0; $i < count($list); $i++) {
$j = $i + 1;
$data[$j] = array(user_uid2username($list[$i]['in_uid']), core_display_datetime($list[$i]['in_datetime']), $list[$i]['in_sender'], $list[$i]['in_msg']);
}
$content = core_csv_format($data);
$fn = 'user_inbox-' . $core_config['datetime']['now_stamp'] . '.csv';
core_download($content, $fn, 'text/csv');
break;
case 'delete':
for ($i = 0; $i < $nav['limit']; $i++) {
$checkid = $_POST['checkid' . $i];
$itemid = $_POST['itemid' . $i];
if ($checkid == "on" && $itemid) {
$up = array('c_timestamp' => mktime(), 'flag_deleted' => '1');
dba_update(_DB_PREF_ . '_tblUser_inbox', $up, array('in_uid' => $user_config['uid'], 'in_id' => $itemid));
}
}
$ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
$_SESSION['error_string'] = _('Selected incoming message has been deleted');
header("Location: " . _u($ref));
}
break;
}
示例7: playnet_hook_webservices_output
function playnet_hook_webservices_output($operation, $requests, $returns)
{
global $plugin_config;
$go = $requests['go'];
$smsc = $requests['smsc'];
$username = $requests['u'];
$password = $requests['p'];
if (!($operation == 'playnet' && $go && $smsc && $username && $password)) {
return FALSE;
}
$c_plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
// auth remote
if (!($c_plugin_config['playnet']['local_playnet_username'] && $c_plugin_config['playnet']['local_playnet_password'] && $c_plugin_config['playnet']['local_playnet_username'] == $username && $c_plugin_config['playnet']['local_playnet_password'] == $password)) {
$content['status'] = 'ERROR';
$content['error_string'] = 'Authentication failed';
$returns['modified'] = TRUE;
$returns['param']['content'] = json_encode($content);
$returns['param']['content-type'] = 'text/json';
return $returns;
}
switch ($go) {
case 'get_outgoing':
$conditions = array('flag' => 1, 'smsc' => $smsc);
$extras = array('ORDER BY' => 'id', 'LIMIT' => $c_plugin_config['playnet']['poll_limit']);
$list = dba_search(_DB_PREF_ . '_gatewayPlaynet_outgoing', '*', $conditions, '', $extras);
foreach ($list as $data) {
$rows[] = array('smsc' => $data['smsc'], 'smslog_id' => $data['smslog_id'], 'uid' => $data['uid'], 'sender_id' => $data['sender_id'], 'sms_to' => $data['sms_to'], 'message' => $data['message'], 'sms_type' => $data['sms_type'], 'unicode' => $data['unicode']);
// update flag
$items = array('flag' => 2);
$condition = array('flag' => 1, 'id' => $data['id']);
dba_update(_DB_PREF_ . '_gatewayPlaynet_outgoing', $items, $condition, 'AND');
// update dlr
$p_status = 1;
dlr($data['smslog_id'], $data['uid'], $p_status);
}
if (count($rows)) {
$content['status'] = 'OK';
$content['data'] = $rows;
} else {
$content['status'] = 'ERROR';
$content['error_string'] = 'No outgoing data';
}
break;
case 'set_incoming':
$payload = json_decode(stripslashes($requests['payload']), 1);
if ($payload['message']) {
$sms_sender = $payload['sms_sender'];
$message = $payload['message'];
$sms_receiver = $payload['sms_receiver'];
if ($id = recvsms(core_get_datetime(), $sms_sender, $message, $sms_receiver, $smsc)) {
$content['status'] = 'OK';
$content['data'] = array('recvsms_id' => $id);
} else {
$content['status'] = 'ERROR';
$content['error_string'] = 'Unable to save incoming data';
}
} else {
$content['status'] = 'ERROR';
$content['error_string'] = 'No incoming data';
}
}
$returns['modified'] = TRUE;
$returns['param']['content'] = json_encode($content);
$returns['param']['content-type'] = 'text/json';
if ($content['status'] == 'OK') {
_log('accessed param_go:[' . $go . '] param_smsc:[' . $smsc . '] param_u:[' . $username . '] param_p:[' . $password . ']', 3, 'playnet_hook_webservices_output');
}
return $returns;
}
示例8: switch
switch ($go) {
case 'export':
$conditions = array('A.flag_deleted' => 0, 'A.in_status' => 1);
$join = "INNER JOIN " . _DB_PREF_ . "_tblUser AS B ON B.flag_deleted='0' AND A.in_uid=B.uid";
$extras = array('AND A.in_keyword' => '!= ""');
$list = dba_search(_DB_PREF_ . '_tblSMSIncoming as A', 'B.username, A.in_id, A.in_uid, A.in_sender, A.in_keyword, A.in_datetime, A.in_feature, A.in_message', $conditions, $search['dba_keywords'], $extras, $join);
$data[0] = array(_('User'), _('Time'), _('From'), _('Keyword'), _('Content'), _('Feature'));
for ($i = 0; $i < count($list); $i++) {
$j = $i + 1;
$data[$j] = array($list[$i]['username'], core_display_datetime($list[$i]['in_datetime']), $list[$i]['in_sender'], $list[$i]['in_keyword'], $list[$i]['in_message'], $list[$i]['in_feature']);
}
$content = core_csv_format($data);
$fn = 'all_incoming-' . $core_config['datetime']['now_stamp'] . '.csv';
core_download($content, $fn, 'text/csv');
break;
case 'delete':
for ($i = 0; $i < $nav['limit']; $i++) {
$checkid = $_POST['checkid' . $i];
$itemid = $_POST['itemid' . $i];
if ($checkid == "on" && $itemid) {
$up = array('c_timestamp' => mktime(), 'flag_deleted' => '1');
dba_update(_DB_PREF_ . '_tblSMSIncoming', $up, array('in_id' => $itemid));
}
}
$ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
$_SESSION['dialog']['info'][] = _('Selected incoming message has been deleted');
header("Location: " . _u($ref));
exit;
}
break;
}
示例9: foreach
}
break;
case "import_yes":
@set_time_limit(0);
$num = $_POST['number_of_row'];
$session_import = $_POST['session_import'];
$data = $_SESSION['tmp'][$session_import];
foreach ($data as $d) {
$name = trim($d[0]);
$destination = trim($d[1]);
$schedule = trim($d[2]);
if ($name && $destination && $schedule) {
$schedule = core_adjust_datetime($schedule);
// add destiantions, replace existing entry with the same name
if (dba_isexists(_DB_PREF_ . '_featureSchedule_dst', array('schedule_id' => $schedule_id, 'name' => $name), 'AND')) {
// update
$items = array('c_timestamp' => mktime(), 'schedule' => $schedule, 'scheduled' => '0000-00-00 00:00:00');
$conditions = array('schedule_id' => $schedule_id, 'name' => $name, 'destination' => $destination);
dba_update(_DB_PREF_ . '_featureSchedule_dst', $items, $conditions);
} else {
// insert
$items = array('schedule_id' => $schedule_id, 'schedule' => $schedule, 'scheduled' => '0000-00-00 00:00:00', 'name' => $name, 'destination' => $destination);
dba_add(_DB_PREF_ . '_featureSchedule_dst', $items);
}
}
}
$_SESSION['dialog']['info'][] = _('Entries in CSV file have been imported');
header("Location: " . _u('index.php?app=main&inc=feature_schedule&route=import&op=list&schedule_id=' . $schedule_id));
exit;
break;
}
示例10: country_update
/**
* Update country
* @param string $id Country ID
* @param array $data Updated data
* @return boolean
*/
function country_update($id, $data = array())
{
$ret = FALSE;
$replaced = '';
if (!($id && is_array($data))) {
return FALSE;
}
$db_table = _DB_PREF_ . '_tblCountry';
$result = dba_search($db_table, '*', array('id' => $id));
foreach ($result[0] as $key => $val) {
$items[$key] = $data[$key] ? $data[$key] : $val;
if ($data[$key]) {
$replaced = $key . ':' . $val . ' ';
}
}
if ($items && trim($replaced)) {
if (dba_update($db_table, $items, array('id' => $id))) {
logger_print('id:' . $id . ' ' . trim($replaced), 3, 'country_update');
$ret = TRUE;
}
}
return $ret;
}
示例11: user_setdatabyuid
/**
* Set user data by uid
*
* @param integer $uid
* User ID
* @param array $data
* User data
* @return boolean TRUE when user data updated
*/
function user_setdatabyuid($uid, $data)
{
if ((int) $uid && is_array($data)) {
$conditions = array('flag_deleted' => 0, 'uid' => $uid);
if (dba_update(_DB_PREF_ . '_tblUser', $data, $conditions)) {
return TRUE;
}
}
return FALSE;
}
示例12: playnet_hook_webservices_output
function playnet_hook_webservices_output($operation, $requests, $returns)
{
global $plugin_config;
$go = $requests['go'];
$smsc = $requests['s'];
$username = $requests['u'];
$password = $requests['p'];
if (!($operation == 'playnet' && $go && $smsc && $username && $password)) {
return FALSE;
}
$c_plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
// auth remote
if (!($c_plugin_config['playnet']['local_playnet_username'] && $c_plugin_config['playnet']['local_playnet_password'] && $c_plugin_config['playnet']['local_playnet_username'] == $username && $c_plugin_config['playnet']['local_playnet_password'] == $password)) {
$content['status'] = 'ERROR';
$content['error_string'] = 'Authentication failed';
$returns['modified'] = TRUE;
$returns['param']['content'] = json_encode($content);
$returns['param']['content-type'] = 'text/json';
return $returns;
}
switch ($go) {
case 'get_outgoing':
$conditions = array('flag' => 1, 'smsc' => $smsc);
$extras = array('ORDER BY' => 'id', 'LIMIT' => $c_plugin_config['playnet']['poll_limit']);
$list = dba_search(_DB_PREF_ . '_gatewayPlaynet_outgoing', '*', $conditions, '', $extras);
foreach ($list as $data) {
$rows[] = array('smsc' => $data['smsc'], 'smslog_id' => $data['smslog_id'], 'uid' => $data['uid'], 'sender_id' => $data['sender_id'], 'sms_to' => $data['sms_to'], 'message' => $data['message'], 'sms_type' => $data['sms_type'], 'unicode' => $data['unicode']);
// update flag
$items = array('flag' => 2);
$condition = array('flag' => 1, 'id' => $data['id']);
dba_update(_DB_PREF_ . '_gatewayPlaynet_outgoing', $items, $condition, 'AND');
// update dlr
$p_status = 1;
dlr($data['smslog_id'], $data['uid'], $p_status);
}
if (count($rows)) {
$content['status'] = 'OK';
$content['data'] = $rows;
} else {
$content['status'] = 'ERROR';
$content['error_string'] = 'No data';
}
break;
}
$returns['modified'] = TRUE;
$returns['param']['content'] = json_encode($content);
$returns['param']['content-type'] = 'text/json';
return $returns;
}
示例13: _
}
$content .= "\n\t\t\t<h2>" . _('Manage autoreply') . "</h2>\n\t\t\t<h3>" . _('Edit SMS autoreply') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_edit_yes method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden name=autoreply_id value=\"{$autoreply_id}\"> \n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=label-sizer>" . _('SMS autoreply keyword') . "</td>\n\t\t\t\t\t<td><input type=text value=\"{$edit_autoreply_keyword}\" readonly></td>\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t" . $select_reply_smsc . "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value='" . _('Save') . "'></p>\n\t\t\t</form>\n\t\t\t<p>" . _back('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_list');
if ($err = TRUE) {
_p(_dialog());
}
_p($content);
break;
case "sms_autoreply_edit_yes":
if (auth_isadmin()) {
$smsc = $_REQUEST['smsc'];
}
if ((int) $autoreply_id && $smsc) {
$db_table = _DB_PREF_ . "_featureAutoreply";
$items = array('smsc' => $smsc);
$conditions = array('autoreply_id' => (int) $autoreply_id);
dba_update($db_table, $items, $conditions);
$_SESSION['dialog']['info'][] = _('SMS autoreply has been updated');
} else {
$_SESSION['dialog']['info'][] = _('Fail to update SMS autoreply');
}
header("Location: " . _u('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_edit&autoreply_id=' . $autoreply_id));
exit;
break;
// scenario
// scenario
case "sms_autoreply_scenario_del":
$_SESSION['dialog']['info'][] = _('Fail to delete SMS autoreply scenario');
if ($autoreply_id && ($autoreply_scenario_id = $_REQUEST['autoreply_scenario_id'])) {
$db_query = "DELETE FROM " . _DB_PREF_ . "_featureAutoreply_scenario WHERE autoreply_id='{$autoreply_id}' AND autoreply_scenario_id='{$autoreply_scenario_id}'";
if (@dba_affected_rows($db_query)) {
$_SESSION['dialog']['info'][] = _('SMS autoreply scenario has been deleted');
示例14: sms_poll_handle
function sms_poll_handle($list, $sms_datetime, $sms_sender, $poll_keyword, $poll_param = '', $sms_receiver = '', $smsc = '', $raw_message = '')
{
$ok = false;
$smsc = gateway_decide_smsc($smsc, $list['smsc']);
$poll_keyword = strtoupper(trim($poll_keyword));
$poll_param = strtoupper(trim($poll_param));
$choice_keyword = $poll_param;
if ($sms_sender && $poll_keyword && $choice_keyword) {
$poll_id = $list['poll_id'];
// if poll disabled then immediately return, just ignore the vote
if (!$list['poll_enable']) {
logger_print('vote s:' . $sms_sender . ' k:' . $poll_keyword . ' c:' . $choice_keyword . ' poll disabled', 2, 'sms_poll');
return TRUE;
}
$db_query = "SELECT choice_id FROM " . _DB_PREF_ . "_featurePoll_choice WHERE choice_keyword='{$choice_keyword}' AND poll_id='{$poll_id}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$choice_id = (int) $db_row['choice_id'];
$db_table = _DB_PREF_ . "_featurePoll_log";
$items = array('poll_id' => $poll_id, 'choice_id' => $choice_id, 'poll_sender' => $sms_sender, 'in_datetime' => core_get_datetime(), 'status' => 0);
// status 0 = failed/unknown
// status 1 = valid
// status 2 = out of vote option
// status 3 = invalid
$log_id = dba_add($db_table, $items);
if ($poll_id && $choice_id) {
$continue = sms_poll_check_option_vote($list, $sms_sender, $poll_keyword, $choice_keyword);
if ($continue) {
// send message valid
if (dba_update($db_table, array('status' => 1), array('log_id' => $log_id))) {
logger_print('vote s:' . $sms_sender . ' k:' . $poll_keyword . ' c:' . $choice_keyword . ' log_id:' . $log_id . ' valid vote', 2, 'sms_poll');
if (($poll_message_valid = trim($list['poll_message_valid'])) && ($c_username = user_uid2username($list['uid']))) {
$unicode = core_detect_unicode($poll_message_valid);
$poll_message_valid = addslashes($poll_message_valid);
list($ok, $to, $smslog_id, $queue_code) = sendsms_helper($c_username, $sms_sender, $poll_message_valid, 'text', $unicode, $smsc);
}
}
} else {
// send message out of vote option
if (dba_update($db_table, array('status' => 2), array('log_id' => $log_id))) {
logger_print('vote s:' . $sms_sender . ' k:' . $poll_keyword . ' c:' . $choice_keyword . ' log_id:' . $log_id . ' out of vote option', 2, 'sms_poll');
if (($poll_message_option = trim($list['poll_message_option'])) && ($c_username = user_uid2username($list['uid']))) {
$unicode = core_detect_unicode($poll_message_option);
$poll_message_option = addslashes($poll_message_option);
list($ok, $to, $smslog_id, $queue_code) = sendsms_helper($c_username, $sms_sender, $poll_message_option, 'text', $unicode, $smsc);
}
}
}
$ok = true;
} else {
// send message invalid
if (dba_update($db_table, array('status' => 3), array('log_id' => $log_id))) {
logger_print('vote s:' . $sms_sender . ' k:' . $poll_keyword . ' c:' . $choice_keyword . ' log_id:' . $log_id . ' invalid vote', 2, 'sms_poll');
if (($poll_message_invalid = trim($list['poll_message_invalid'])) && ($c_username = user_uid2username($list['uid']))) {
$unicode = core_detect_unicode($poll_message_invalid);
$poll_message_invalid = addslashes($poll_message_invalid);
list($ok, $to, $smslog_id, $queue_code) = sendsms_helper($c_username, $sms_sender, $poll_message_invalid, 'text', $unicode, $smsc);
}
}
}
}
return $ok;
}
示例15: sender_id_default_set
function sender_id_default_set($uid, $sender_id)
{
$db_table = _DB_PREF_ . '_tblUser';
$items = array('sender' => $sender_id);
$conditions = array('flag_deleted' => 0, 'uid' => $uid);
$ret = dba_update($db_table, $items, $conditions);
return $ret;
}